Public
Edited
May 29, 2024
Fork of Choropleth
Insert cell
Insert cell
Insert cell
color = {
const thresholds = [0, 1, 2, 3, 4, 5];
const positive = d3
.scaleThreshold()
.domain(thresholds)
.range(d3.schemeGreens[thresholds.length + 1]);
const negative = d3
.scaleThreshold()
.domain(thresholds)
.range(d3.schemeOranges[thresholds.length + 1]);
return (x) =>
x === undefined
? "transparent"
: x >= 0
? positive(x)
: negative(Math.abs(x));
}
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