Public
Edited
Jun 16, 2024
Paused
Comments locked
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
records
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
bestOf
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
Insert cell
Insert cell
bestOf = d3
.filter(records, (x) => x.best === "x")
.map(({ best, ...rest }) => rest)
Insert cell
records = (
await d3
.csv(endpoint)
.then((data) => data)
.catch((fault) => Object.assign([], { columns: [], error: fault.message }))
).map(({ "good name": best, ...rest }) =>
Object.assign(rest, {
rgb: (({ r, g, b, ...discard }) => [r, g, b])(d3.rgb(rest.hex)).join(" "),
hsl: (({ h, s, l, ...discard }, n) =>
[h, s, l].map(
(x, i) =>
((+x || 0) * (i ? 100 : 1))
.toFixed(n)
.replace(/(?:[.]0+|([.]\d+?)0+)$/, "$1") + (i ? "%" : "")
))(d3.hsl(rest.hex), 5).join(" "),
best
})
)
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