Public
Edited
Sep 6, 2023
1 star
Also listed in…
Political Issues
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
total_vote_counts = {
let dvotes = d3.sum(precinct_data.features.map((o) => o.properties.dvotes));
let rvotes = d3.sum(precinct_data.features.map((o) => o.properties.rvotes));
return { dvotes, rvotes };
}
Insert cell
map_data = FileAttachment("buncombe_precincts_with_data@2.json").json()
Insert cell
precinct_data = topojson.feature(
map_data,
map_data.objects.buncombe_precincts_with_data
)
Insert cell
road_data = topojson.feature(map_data, map_data.objects.centerline)
Insert cell
Insert cell
path = d3.geoPath().projection(projection)
Insert cell
projection = d3.geoIdentity().reflectY(true).fitSize([w, h], precinct_data)
Insert cell
h = 0.7 * w
Insert cell
w = width < 1200 ? width : 1200
Insert cell
Insert cell
import { Legend } from "@d3/color-legend"
Insert cell
tippy_style = html`<div style="display: none"><link rel="stylesheet" href="${await require.resolve(
`tippy.js/themes/light-border.css`
)}"></div>`
Insert cell
tippy = require("tippy.js@6")
Insert cell
d3.geoConicEqualArea
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more