Published
Edited
Oct 5, 2020
6 stars
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

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