Published
Edited
Feb 12, 2020
1 fork
2 stars
Insert cell
md`# Attribute join by linking topojson with csv files
Median Age in Iowa Counties, Source: [Census 2010]`
Insert cell
d3 = require("d3@5")
Insert cell
import {legend} from "@d3/color-legend"
Insert cell
format = d => `${d}%`
Insert cell
topojson = require("topojson-client@3")
Insert cell
iowa = FileAttachment("iowa_counties_topo.json").json()
Insert cell
counties = topojson.feature(iowa, iowa.objects.iowa_counties)
Insert cell
med_age = d3.csvParse(await FileAttachment("iowa_counties.csv").text(),({FIPS, MED_AGE}) => [FIPS, +MED_AGE])
Insert cell
data = Object.assign(new Map(med_age), {title: "Median Age"})
Insert cell
color = d3.scaleSequentialQuantile([...data.values()], d3.interpolateBlues)
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