Published
Edited
Dec 6, 2018
2 stars
Also listed in…
SF Bay Area Jobs Viz
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
tracts = {
const tracts = topojson.feature(tractsTopoJSON, tractsTopoJSON.objects[topojsonObj])

tracts.features = tracts.features.map(d => ({
...d,
properties: {
change: Number(d.properties[`${category}_c`]),
lq2015: Number(d.properties[`${category}_15`]),
quintile: d.properties.quintile
}
}))
return tracts
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
lqChangeExtent = d3.extent(tracts.features.map(d => d.properties.change))
Insert cell
lqChangeThresholds = [-1.5, -0.1, 0.1, 1.5]
Insert cell
lqChangeScale = d3.scaleThreshold()
.domain(lqChangeThresholds)
.range(curRamp)
Insert cell
Insert cell
lq2015Extent = d3.extent(tracts.features.map(d => d.properties.lq2015))
Insert cell
lq2015Thresholds = [0.8, 1.2, 1.5]
Insert cell
lq2015Scale = d3.scaleThreshold()
.domain(lq2015Thresholds)
.range(curRamp.slice(1)) // don't need the bottom most color value
Insert cell
Insert cell
Insert cell
mapFrameSpec = {
const spec = {
shouldDisplay: showMapframe,
width: 334,
height: 432,
upperLeft: [403, 561]
}
spec.bottomRight = [spec.upperLeft[0] + spec.width, spec.upperLeft[1] + spec.height]

return spec
}
Insert cell
mapFrameCoords = [
projection.invert(mapFrameSpec.upperLeft),
projection.invert(mapFrameSpec.bottomRight)
]
Insert cell
mapFrameGeoJSON = JSON.stringify({
type: 'Feature',
geometry: {
type: 'LineString',
coordinates: [mapFrameCoords[0], mapFrameCoords[1]]
}
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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