Move knots app into subdirectory
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
---
|
||||
title: "Data Science Methods for Forecasting in Energy and Economics"
|
||||
title: "Knots-Demo"
|
||||
date: 2025-07-10
|
||||
format:
|
||||
revealjs:
|
||||
embed-resources: true
|
||||
footer: ""
|
||||
execute:
|
||||
daemon: false
|
||||
highlight-style: github
|
||||
---
|
||||
|
||||
|
||||
```{ojs}
|
||||
d3 = require("d3@7")
|
||||
```
|
||||
|
||||
```{ojs}
|
||||
bsplineData = FileAttachment("assets/mcrps_learning/basis_functions.csv").csv({ typed: true })
|
||||
bsplineData = FileAttachment("basis_functions.csv").csv({ typed: true })
|
||||
```
|
||||
|
||||
```{ojs}
|
||||
@@ -109,8 +109,8 @@ chart = {
|
||||
});
|
||||
|
||||
// Build SVG
|
||||
const width = 800;
|
||||
const height = 400;
|
||||
const width = 1200;
|
||||
const height = 450;
|
||||
const margin = {top: 40, right: 20, bottom: 40, left: 40};
|
||||
const innerWidth = width - margin.left - margin.right;
|
||||
const innerHeight = height - margin.top - margin.bottom;
|
||||
@@ -141,15 +141,6 @@ chart = {
|
||||
.attr("preserveAspectRatio", "xMidYMid meet")
|
||||
.attr("style", "max-width: 100%; height: auto;");
|
||||
|
||||
// Add chart title
|
||||
// svg.append("text")
|
||||
// .attr("class", "chart-title")
|
||||
// .attr("x", width / 2)
|
||||
// .attr("y", 20)
|
||||
// .attr("text-anchor", "middle")
|
||||
// .attr("font-size", "20px")
|
||||
// .attr("font-weight", "bold");
|
||||
|
||||
// Create the chart group
|
||||
const g = svg.append("g")
|
||||
.attr("transform", `translate(${margin.left},${margin.top})`);
|
||||
@@ -166,20 +157,6 @@ chart = {
|
||||
.call(d3.axisLeft(y).ticks(5))
|
||||
.style("font-size", "20px");
|
||||
|
||||
// Add axis labels
|
||||
// g.append("text")
|
||||
// .attr("x", innerWidth / 2)
|
||||
// .attr("y", innerHeight + 35)
|
||||
// .attr("text-anchor", "middle")
|
||||
// .text("x");
|
||||
|
||||
// g.append("text")
|
||||
// .attr("transform", "rotate(-90)")
|
||||
// .attr("x", -innerHeight / 2)
|
||||
// .attr("y", -30)
|
||||
// .attr("text-anchor", "middle")
|
||||
// .text("y");
|
||||
|
||||
// Add a horizontal line at y = 0
|
||||
g.append("line")
|
||||
.attr("x1", 0)
|
||||
@@ -229,4 +206,4 @@ chart = {
|
||||
container.node().appendChild(svg.node());
|
||||
return container.node();
|
||||
}
|
||||
```
|
||||
```
|
||||
Reference in New Issue
Block a user