Public
Edited
Apr 23, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
height = 610
Insert cell
width = 975
Insert cell
path_points = d3.geoPath().projection(projection)
Insert cell
Insert cell
path_basemap = d3.geoPath().projection(projection)
Insert cell
Insert cell
projection = d3.geoAlbers()
Insert cell
format = d3.format(".1s")
Insert cell
//proportional symbols
//radius = d3.scaleSqrt([0, d3.max(attribute)], [0, 30])
Insert cell
radius = d3.scaleThreshold()
.domain(naturalbreaks)
.range(radiusArray)
Insert cell
Insert cell
sizeArrayForLegend = Array.from(radiusArray, d=>Math.PI*Math.pow(d, 2))

Insert cell
Insert cell
radiusArray = [5, 10, 25, 20, 50]

Insert cell
Insert cell
circleLabels = Array.from(naturalbreaks, d=> format(Math.pow(d, 2)))
Insert cell
Insert cell
colors = d3.scaleThreshold()
.domain(naturalbreaks)
.range(GnBu)
Insert cell
Insert cell
GnBu = ["#f0f9e8", "#bae4bc", "#7bccc4", "#43a2ca", "#0868ac"]
Insert cell
Insert cell
naturalbreaks = simple.ckmeans(attribute, 5).map(v => v.pop())
Insert cell
Insert cell
d3.max(attribute)
Insert cell
Insert cell
attribute = Array.from(points.features, d=>Math.sqrt(d.properties[attributeName]))
Insert cell
Insert cell
attributeName = ("POPULATION")
Insert cell
Insert cell
idName = "STNAME"
Insert cell
Insert cell
points = FileAttachment("cities.geojson").json()
Insert cell
Insert cell
wgs84Pop20201 = FileAttachment("cities.geojson").json()
Insert cell
Insert cell
basepolygons = FileAttachment("states_simple.json").json()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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