Published
Edited
Feb 14, 2021
2 stars
Insert cell
Insert cell
chart2
Insert cell
import { chart as chart2} with { title, your_FIPS_value_array as dataFipsAndValueArray, colorCovid as color, legendAttributes as legendAttributes} from "@chonghorizons/choropleth-with-legend-attributes-added"
Insert cell
Insert cell
Insert cell
chart
Insert cell
import { chart } with { title, COVIDformattedData as dataFipsAndValueMap, colorCovid as color, legendAttributes as legendAttributes} from "@chonghorizons/choropleth-with-legend-attributes-added"
Insert cell
Insert cell
COVIDurl="https://raw.githubusercontent.com/youyanggu/covid19-infection-estimates-latest/main/counties/1_latest_percent_infected_counties.csv"
Insert cell
fetchedCOVIDdata=d3.csv(COVIDurl)
Insert cell
Insert cell
your_FIPS_value_array= fetchedCOVIDdata.map( d => {
return [d.fips, Math.floor(Number(d.perc_current_infected_mean)*10000)/100]
}).filter( d => { return d[1]>0 } )
// a two element array. FIPS and the value you want to plot)
Insert cell
md` * Mike Bostock used a map object rather than an array`
Insert cell
COVIDformattedData=new Map(your_FIPS_value_array)

Insert cell
title="Community Covid Rate (%)"
Insert cell
colorCovid = d3.scaleQuantize([0, 5], d3.schemeBlues[9])
Insert cell
d3 = require("d3@6")
Insert cell
legendAttributes = ({ tickFormat: ".1f" })
Insert cell
Insert cell
md`## Changelog:
2021
Feb 10ish: original
Feb 13: Thanks @mootari. If the cell data is undefined, the tooltip now says "No Data".`
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