Update cdf weights plot
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: "Knots-Demo"
|
||||
title: "CDF Weights"
|
||||
date: 2025-07-10
|
||||
format:
|
||||
revealjs:
|
||||
@@ -15,7 +15,7 @@ d3 = require("d3@7")
|
||||
```
|
||||
|
||||
```{ojs}
|
||||
bsplineData = FileAttachment("basis_functions.csv").csv({ typed: true })
|
||||
cdf_data = FileAttachment("cdf_data.csv").csv({ typed: true })
|
||||
```
|
||||
|
||||
```{ojs}
|
||||
@@ -47,9 +47,9 @@ function updateChartInner(g, x, y, linesGroup, color, line, data) {
|
||||
|
||||
chart = {
|
||||
// State variable for selected mu parameter
|
||||
let selectedMu = 0.5;
|
||||
let selectedMu = 1;
|
||||
|
||||
const filteredData = () => bsplineData.filter(d =>
|
||||
const filteredData = () => cdf_data.filter(d =>
|
||||
Math.abs(selectedMu - d.mu) < 0.001
|
||||
);
|
||||
|
||||
@@ -84,7 +84,11 @@ chart = {
|
||||
muDisplay.text(selectedMu.toFixed(1));
|
||||
updateChart(filteredData());
|
||||
})
|
||||
.style('width', '100%');
|
||||
.style('width', '100%')
|
||||
//.style('-webkit-appearance', 'none')
|
||||
.style('appearance', 'none')
|
||||
.style('height', '8px')
|
||||
.style('background', '#BDBDBDFF');
|
||||
|
||||
const muDisplay = sliderContainer.append('span')
|
||||
.text(selectedMu.toFixed(1))
|
||||
@@ -104,7 +108,7 @@ chart = {
|
||||
});
|
||||
|
||||
// Build SVG
|
||||
const width = 1200;
|
||||
const width = 800;
|
||||
const height = 450;
|
||||
const margin = {top: 40, right: 20, bottom: 40, left: 40};
|
||||
const innerWidth = width - margin.left - margin.right;
|
||||
|
||||
Reference in New Issue
Block a user