Published
Edited
Oct 5, 2020
6 stars
Also listed in…
Election Explorations
Insert cell
Insert cell
viewof selectionDemo
Insert cell
Insert cell
selectionDemo.sort((a, b) => a.NAME.localeCompare(b.NAME))
Insert cell
exampleWidth = width
Insert cell
exampleHeight = 500
Insert cell
countyShapes
Insert cell
viewof selectionIncome
Insert cell
selectionIncome
Insert cell
import {viewof selection as selectionDemo} with {
demographicsDataNiceKeys as data,
demoKeys as keys,
color as z,
colorKey as keyz,
height as height
} from "@d3/brushable-parallel-coordinates"
Insert cell
import {viewof selection as selectionIncome} with {
demographicsDataNiceKeys as data,
incomeKeys as keys,
color as z,
colorKey as keyz,
height as height
} from "@d3/brushable-parallel-coordinates"
Insert cell
import {
demographicsData,
selectedFields,
niceLabel,
countyShapes
} from "@enjalot/us-county-datasets"
Insert cell
demographicsData[2018]
Insert cell
selectedFields
Insert cell
niceKeys = selectedFields.map(d => niceLabel(d))
Insert cell
demographicsDataNiceKeys = {
let array = Array.from(demographicsData[2018]).map(d => {
let o = { ... d[1]}
selectedFields.forEach(key => {
let k = niceLabel(key)
o[k] = o[key]
delete o[key]
if(k == "gini index of income inequality: gini index" && o[k] < 0) o[k] = 0
})
return o
})
let bounds = {}
demoKeys.forEach(key => {
bounds[key] = -1
})
incomeKeys.forEach(key => {
bounds[key] = 600000
})
bounds[incomeKeys[0]] = 1
array.push(bounds)
return array
}
Insert cell
demoKeys = niceKeys.slice(0, 14)
Insert cell
incomeKeys = niceKeys.slice(14)
Insert cell
color = () => "seagreen"
Insert cell
colorKey = niceLabel(selectedFields[0])
Insert cell
height = 600
Insert cell
d3 = require("d3@6")
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more