Published
Edited
May 11, 2022
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
us = d3.json("https://unpkg.com/us-atlas@3/counties-10m.json")
Insert cell
countyShapes = topojson.feature(us, us.objects.counties)//.features
Insert cell
csv_data = d3.csvParse(await FileAttachment("nitrogen@4.csv").text(),({FIPS, Nitrogen}) => [FIPS, +Nitrogen])
Insert cell
nitrodata = Object.assign(new Map(csv_data), {title: "Nitrogen Runoff"})
Insert cell
Insert cell
populationColor = d3.scaleSequential
(populationExtent, d3.interpolateGreens)

Insert cell
color = {
return value => {
if (!value) return "#ccc";
};
}
Insert cell
populationFormat = d3.format(",d")
Insert cell
statesByFips = new Map(us.objects.states.geometries.map(d => [d.id, d.properties]))
Insert cell
// The borders of the states are merged so we can render a single line where they would otherwise overlap
statesMesh = topojson.mesh(us, us.objects.states, (a, b) => a !== b)
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