Published
Edited
Dec 12, 2021
Fork of Simple D3
Insert cell
# Sectors of Economy
Insert cell
import {TimeChart, TimeAxis, d3} from "@observablehq/timechart"
Insert cell
interval = d3.utcDay.every(1) // sample frequency
Insert cell
stop = interval() // exclusive
Insert cell
start = interval.offset(stop, -width) // inclusive
Insert cell
timeOptions = {
const interval = d3.utcMinute.every(1440)
const stop = new Date("2020-04-07T12:45");
return {
interval,
start: interval.offset(stop, -width),
stop,
width
};
}
Insert cell
EconomySectors = html`
${TimeAxis.defaults(timeOptions)()}
${[100, 200, 300, 400, 500, 600].map(status => {
return TimeChart.defaults(timeOptions)(data2.filter(d => d.status == status), {
title: status,
marginTop: 1,
scheme: ["blues", "greys", "greens", "purples", "reds", "BuPu"][Math.floor(status / 100) - 1]
});
})
}
`
Insert cell
data2 = {
// Not authenticated; use demo data
return FileAttachment("123@6.csv").csv({ typed: true });
}
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