Published
Edited
May 17, 2020
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
topojson = require("topojson-client@3")
Insert cell
d3 = require('d3@5')
Insert cell
montana_topojson = FileAttachment("montana_census_tracts_topo.json").json()
Insert cell
montana_tracts = topojson.feature(
montana_topojson,
montana_topojson.objects.montana_census_tracts
)
Insert cell
projection = d3.geoMercator().fitSize([width, height], montana_tracts)
Insert cell
Insert cell
Insert cell
min_max = {
const census_vals = Object.values(census_data).map(c => c.B01003_001E);
const min = Math.min(...census_vals);
const max = Math.max(...census_vals);
return [min, max];
}
Insert cell
scale = d3
.scalePow()
.domain(min_max)
.range(['#fff5eb', '#7f2704'])
Insert cell
Insert cell
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