Published
Edited
Feb 27, 2020
1 star
Insert cell
Insert cell
Insert cell
grouped = d3.groups(incidents, d => d.district)
Insert cell
rolledup = d3.rollups(incidents, values => d3.sum(values, d => d.count), d => d.district)
Insert cell
Insert cell
districts = sorted.map(d => d[0])
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
const bars = d3.select(barChart)
.select("g#bars")
.selectAll("rect")
.data(sorted);
const lines = d3.select(lineChart)
.select("g#lines")
.selectAll("path")
.data(grouped);
const debug = html`<p>${bars.size()} bars selected</p>`;

// TODO
return debug;
}
Insert cell
{
const bars = d3.select("svg#bar-chart")
.select("g#bars")
.selectAll("rect")
.data(sorted);
const lines = d3.select("svg#line-chart")
.select("g#lines")
.selectAll("path")
.data(grouped);
const debug = html`<p>${lines.size()} lines selected</p>`;
// TODO
return debug;
}
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

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