Published
Edited
May 11, 2020
Fork of Maps
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
data = d3.csvParse(
await FileAttachment("acs2017_census_tract_data.csv").text(),
d3.autoType
)
Insert cell
render_data_table(data.slice(0, 10))
Insert cell
md` This data set is from Kaggle, and it shows census data for counties and states across the USA in 2017. This includes income, ethnic and professional data for each location. `
Insert cell
Insert cell
newData = d3
.nest()
.key(dataTable => dataTable.State)
.rollup(dataTable => d3.sum(dataTable, d => d.TotalPop))
.entries(data)
.map(dataTable => {
return {
name: dataTable.key,
value: dataTable.value
};
})
Insert cell
color = d3.scaleQuantize([minAmount, maxAmount], d3.schemeReds[7])
Insert cell
maxAmount = d3.max(newData.map(d => d.value))
Insert cell
minAmount = d3.min(newData.map(d => d.value))
Insert cell
Insert cell
counties = FileAttachment("counties-albers-10m.json").json()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
d3 = require("d3")
Insert cell
height = 800
Insert cell
path = d3.geoPath()
Insert cell
_ = require("lodash@4")
Insert cell
html`<style>
body {
font-family: Montserrat;
color: black;
}
</style>`
Insert cell
topojson = require("topojson-client@3")
Insert cell
import { legend } from "@d3/color-legend"
Insert cell
format = d => `${d}%`
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