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
|
date: 2025-07-10
|
||||||
format:
|
format:
|
||||||
revealjs:
|
revealjs:
|
||||||
embed-resources: true
|
embed-resources: true
|
||||||
footer: ""
|
|
||||||
execute:
|
execute:
|
||||||
daemon: false
|
daemon: false
|
||||||
highlight-style: github
|
highlight-style: github
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
```{ojs}
|
```{ojs}
|
||||||
d3 = require("d3@7")
|
d3 = require("d3@7")
|
||||||
```
|
```
|
||||||
|
|
||||||
```{ojs}
|
```{ojs}
|
||||||
bsplineData = FileAttachment("assets/mcrps_learning/basis_functions.csv").csv({ typed: true })
|
bsplineData = FileAttachment("basis_functions.csv").csv({ typed: true })
|
||||||
```
|
```
|
||||||
|
|
||||||
```{ojs}
|
```{ojs}
|
||||||
@@ -109,8 +109,8 @@ chart = {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Build SVG
|
// Build SVG
|
||||||
const width = 800;
|
const width = 1200;
|
||||||
const height = 400;
|
const height = 450;
|
||||||
const margin = {top: 40, right: 20, bottom: 40, left: 40};
|
const margin = {top: 40, right: 20, bottom: 40, left: 40};
|
||||||
const innerWidth = width - margin.left - margin.right;
|
const innerWidth = width - margin.left - margin.right;
|
||||||
const innerHeight = height - margin.top - margin.bottom;
|
const innerHeight = height - margin.top - margin.bottom;
|
||||||
@@ -141,15 +141,6 @@ chart = {
|
|||||||
.attr("preserveAspectRatio", "xMidYMid meet")
|
.attr("preserveAspectRatio", "xMidYMid meet")
|
||||||
.attr("style", "max-width: 100%; height: auto;");
|
.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
|
// Create the chart group
|
||||||
const g = svg.append("g")
|
const g = svg.append("g")
|
||||||
.attr("transform", `translate(${margin.left},${margin.top})`);
|
.attr("transform", `translate(${margin.left},${margin.top})`);
|
||||||
@@ -166,20 +157,6 @@ chart = {
|
|||||||
.call(d3.axisLeft(y).ticks(5))
|
.call(d3.axisLeft(y).ticks(5))
|
||||||
.style("font-size", "20px");
|
.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
|
// Add a horizontal line at y = 0
|
||||||
g.append("line")
|
g.append("line")
|
||||||
.attr("x1", 0)
|
.attr("x1", 0)
|
||||||
Reference in New Issue
Block a user