Unlisted
Edited
Jul 6, 2023
Fork of Choropleth
92 forks
Importers
31 stars
Insert cell
Insert cell
Insert cell
chart = UsStateChoropleth(unemployment, {
id: d => namemap.get(d.name),
value: d => d.rate,
scale: d3.scaleQuantize,
domain: [1, 7],
range: d3.schemeBlues[6],
title: (f, d) => `${f.properties.name}\n${d?.rate}%`
})
Insert cell
unemployment = FileAttachment("unemployment201907.csv").csv({typed: true})
Insert cell
Insert cell
namemap = new Map(states.features.map(d => [d.properties.name, d.id]))
Insert cell
Insert cell
function UsStateChoropleth(data, {
features = states,
borders = statemesh,
width = 975,
height = 610,
...options
} = {}) {
return Choropleth(data, {features, borders, width, height, ...options});
}
Insert cell
Insert cell
import {howto} from "@d3/example-components"
Insert cell
import {us, states, statemesh, Choropleth, Legend} from "@d3/choropleth"
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more