Published
Edited
Aug 7, 2019
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
horizonchart_x = d3.scaleTime()
.domain([parseDate(1700), parseDate(2020)])
.range([0, width])
.nice()
Insert cell
horizonchart_y = d3.scaleLinear()
.domain([0, d3.max(horizonchart_data, d => d3.max(d.values, d => d.value))])
.range([0, -horizonchart_overlap * horizonchart_step])
Insert cell
horizonchart_xAxis = g => g
.attr("transform", `translate(0,${horizonchart_margin.top})`)
.call(d3.axisTop(horizonchart_x).ticks(width / 80).tickSizeOuter(0))
.call(g => g.selectAll(".tick").filter(d => horizonchart_x(d) < horizonchart_margin.left || horizonchart_x(d) >= width - horizonchart_margin.right).remove())
.call(g => g.select(".domain").remove())
Insert cell
horizonchart_area = d3.area()
.curve(d3.curveBasis)
.defined(d => !isNaN(d.value))
.x(d => horizonchart_x(d.date))
.y0(0)
.y1(d => horizonchart_y(d.value))
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
d3Legend = require("d3-svg-legend")
Insert cell
Insert cell
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