Published
Edited
Nov 3, 2021
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
precincts = topojson.feature(pollingplaces, pollingplaces.objects[Object.keys(pollingplaces.objects)[0]])
Insert cell
path = d3.geoPath(projection)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
data = d3.csv("https://live-election-results.herokuapp.com/https://shutdown.network/data/columbia.csv")
Insert cell
candidates = data.columns.slice(2,data.columns.indexOf("Total"))
Insert cell
results =
{
if(precinct==null)
return aq.from(data).select(candidates).fold(aq.all()

).pivot('key', { value: d => op.sum(d.value) }).objects()
else
return aq.from(data).filter(aq.escape(d=>d.precinct_id==precinct.properties.PRECINCTID)).select(candidates).objects()
}
Insert cell
precinctMap = new Map(data.map((d) => [d["precinct_id"], d.leader]))
Insert cell
updateTime = fetch("https://live-election-results.herokuapp.com/https://shutdown.network/data/columbia.csv",{
method: 'GET'}).then(d=> {return d.headers.get("Last-modified")})
Insert cell
updatedAt=moment(updateTime).format("h:mm A on MMMM D")
Insert cell
moment=require("moment")
Insert cell
import {Legend, Swatches} from "@d3/color-legend"
Insert cell
import {vl} from "@vega/vega-lite-api"
Insert cell
import { aq, op } from '@uwdata/arquero'
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