Published
Edited
Feb 21, 2021
Insert cell
Insert cell
Insert cell
topojson = require("topojson-client@3")
Insert cell
states = FileAttachment("ILwithcount.json").json()
Insert cell
states_features = topojson.feature(states, states.objects.ILwithcount )
Insert cell
csv_data = d3.csvParse(await FileAttachment("ILwithcountplsberight.csv").text(),({GEOID, acresoffarmlandp4_Value, acresoffarmlandp4_land_acres}) => [+GEOID,+acresoffarmlandp4_Value/+acresoffarmlandp4_land_acres])
Insert cell
fips = Array.from(csv_data.values(), d => d[0])
Insert cell
//this is how to take the values of a variable (column) from all variables you created from the csv file
age5_17pct = Array.from(csv_data.values(), d => d[1])
Insert cell
femalespct = Array.from(csv_data.values(), d => d[1])
Insert cell
//this is how you map the id column to the values. We will use this for joining with topojson later.
data = Object.assign(new Map(csv_data), {title: "Percentage of Age Group 5 to 17"})
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