Unlisted
Edited
Nov 11, 2022
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
stateShapes
Insert cell
data = {
let raw = FileAttachment("testData.csv").csv()
return (await raw).map(d => ({...d,
value: +d.value
}))
}
Insert cell
Insert cell
Insert cell
index = new Map(data.map(d => [d.State, d.value]))
Insert cell
Insert cell
{
const shapes = JSON.parse(JSON.stringify(stateShapes)); // do a copy, rather than mutate
for (const f of shapes.features) {
f.properties.value = index.get(f.properties.name);
}
return shapes;
}
Insert cell
Insert cell
index1 = new Map(data.map(d => [d.State, d]))
Insert cell
Insert cell
test = {
const shapes = JSON.parse(JSON.stringify(stateShapes)); // do a copy, rather than mutate
for (const f of shapes.features) {
f.properties.data = index1.get(f.properties.name);
}
return shapes;
}
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