Published
Edited
Mar 10, 2021
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
data = (await FileAttachment(
"cbo-data.csv"
).csv()).map(({ on, about, value }) => ({
on: new Date(on),
about: new Date(about),
value: +value
}))
Insert cell
on = Array.from(new Set(data.map(d => +d.on)))
.sort((a, b) => a - b)
.map(d => new Date(d))
Insert cell
about = Array.from(new Set(data.map(d => +d.about)))
.sort((a, b) => a - b)
.map(d => new Date(d))
Insert cell
getDatum = (dOn, dAbout) => data
.find(({on, about}) => +on === +dOn && +about === +dAbout)
?.value
.toFixed(2) || ""
Insert cell
getFilter = (dOn, dAbout) => `blur(${d3.timeYear.count(dOn, dAbout) / 4}px)`
Insert cell
d3 = require("d3@6")
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