Public
Edited
Jan 27, 2023
Insert cell
viewof x = Inputs.range([0, 125000], {step: 100})
Insert cell
viewof y = Inputs.range([0, 50000], {step: 100})
Insert cell
viewof scale = Inputs.range([0, 80000], {step: 100})
Insert cell
Insert cell
projection = d3.geoMercator().translate([x, y]).scale(scale)
Insert cell
offices = Object.assign(new Map(d3.csvParse(await FileAttachment("do_counties_fy21_whis.csv").text(), ({wh_office_name, region_name}) => [wh_office_name, region_name])))
Insert cell
whis20 = Object.assign(new Map(d3.csvParse(await FileAttachment("do_counties_fy21_whis.csv").text(), ({wh_office_name, FY20}) => [wh_office_name, FY20])))
Insert cell
whis22 = Object.assign(new Map(d3.csvParse(await FileAttachment("do_counties_fy21_whis.csv").text(), ({wh_office_name, FY22}) => [wh_office_name, FY22])))
Insert cell
office_coords = d3.csvParse(await FileAttachment("WHD_Offices.csv").text())
.map(obj => {
let proj = projection([obj.lon, obj.lat])
return {
name: obj.name,
lat: parseFloat(obj.lat),
lon: parseFloat(obj.lon),
x: proj ? proj[0] : -1,
y: proj ? proj[1] : -1,
}
})
.filter(obj => obj.x > -1 && obj.y > -1)
Insert cell
color = d3.scaleOrdinal(d3.schemeTableau10)
Insert cell
path = d3.geoPath(projection)
Insert cell
us = FileAttachment("miami_2010_albersusa_topo.json").json()
Insert cell
topojson = require("topojson-client@3")
Insert cell
d3 = require("d3@6")
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