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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more