Published
Edited
Mar 29, 2021
1 fork
Insert cell
md`# Final Project Porposal`
Insert cell
md`## Project Idea`
Insert cell
md`## Team Members`
Insert cell
md`I will be working on this final project alone. `
Insert cell
md`## Goals and Objectives`
Insert cell
Insert cell
md`## Data`
Insert cell
Insert cell
md`## Related Literature`
Insert cell
Insert cell
md`## Planning Representation Techniques`
Insert cell
Insert cell
d3 = require("d3@5")
Insert cell
import {legend} from "@d3/color-legend"
Insert cell
simple = require("simple-statistics@7.0.7/dist/simple-statistics.min.js")
Insert cell
format = d => `${d}%`
Insert cell
topojson = require("topojson-client@3")
Insert cell
iowa = FileAttachment("ia_covid19 (2).json").json()
Insert cell
counties = topojson.feature(iowa, iowa.objects.ia_covid19)
Insert cell
Covid_data = d3.csvParse(await FileAttachment("ia_covid19_county.csv").text(),({FIPS, Confirmed, Deaths, pop_est_20}) => [+FIPS, +Deaths/+pop_est_20 * 100])
Insert cell
Census_data = d3.csvParse(await FileAttachment("Census_Ia_Data-1 (1).csv").text(),({FIPS, POPESTIMATE, AGE85PLUS_TOT}) => [+FIPS, +AGE85PLUS_TOT/+POPESTIMATE * 100])
Insert cell
data2 = Object.assign(new Map(Covid_data), {title: "Percent of Population that Died from Coivd"})
Insert cell
data = Object.assign(new Map(Census_data), {title: "Percent Over 85"})
Insert cell
Percent_Over_85 = Array.from(Census_data.values(), d => d[1])
Insert cell
Percent_Deaths = Array.from(Covid_data.values(), d => d[1])
Insert cell
YlGnBu = [d3.color("#fee5d9"), d3.color("#fcae91"), d3.color("#fb6a4a"), d3.color("#cb181d")]
Insert cell
quantile = d3.scaleQuantile()
.domain(Percent_Deaths)
.range(YlGnBu)
Insert cell
quantile2 = d3.scaleQuantile()
.domain(Percent_Over_85)
.range(YlGnBu)
Insert cell
width = 975
Insert cell
height = 610
Insert cell
margin = 100
Insert cell
projection = d3.geoTransverseMercator().rotate([94,0]).fitExtent([[80, 80], [width, height]], counties);
Insert cell
path = d3.geoPath().projection(projection);
Insert cell
choropleth = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
svg.append("g")
.attr("transform", "translate(360,20)")
.append(() =>
legend({
color: quantile,
title: data2.title,
width: 260,
tickFormat: ".1f"
})
);
svg.append("g")
.selectAll("path")
.data(counties.features)
.join("path")
.attr("stroke", "white")
.attr("stroke-linejoin", "round")
.attr("stroke-width", 1)
.attr("fill", d => quantile(data2.get(+d.properties.FIPS)))
.attr("d", path)
.append("title")
.text(d => " Pecent of Population over 85: " + data2.get(+d.properties.FIPS));

return svg.node();
}
Insert cell
choropleth2 = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
svg.append("g")
.attr("transform", "translate(360,20)")
.append(() =>
legend({
color: quantile2,
title: data.title,
width: 260,
tickFormat: ".1f"
})
);
svg.append("g")
.selectAll("path")
.data(counties.features)
.join("path")
.attr("stroke", "white")
.attr("stroke-linejoin", "round")
.attr("stroke-width", 1)
.attr("fill", d => quantile2(data.get(+d.properties.FIPS)))
.attr("d", path)
.append("title")
.text(d => " Pecent of Population over 85: " + data.get(+d.properties.FIPS));

return svg.node();
}
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