Public
Edited
Jan 28, 2021
5 stars
Insert cell
Insert cell
Insert cell
data = d3.range(100).map(Math.random)
Insert cell
sawtooth()
Insert cell
// INPUT: cumulative chart
// OUTPUT: segments
function sawtooth(data, width, height, opts = {}) {
let nb_parts = 10
//var bc = binCumulative().thresholds(d3.range(100).map(d => d * nb_parts)).value(value)(cc)

const x = d3.scaleTime()
.domain([new Date("2020-01-01"), new Date("2020-05-01")])
.range([0, width])

const node = DOM.svg(400, 300)
const svg = d3.select(node)
svg.attr('style', 'border: 1px solid gray');
return svg.node();

}
Insert cell
import {binCumulative} from "@fil/cumulative-binning"
Insert cell
import { checkbox, select, slider } from "@jashkenas/inputs"
Insert cell
d3 = require("d3@v6")
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more