Public
Edited
Apr 29, 2022
2 forks
Importers
Insert cell
Insert cell
<svg width=1000 height=500>
<style>
.mapGrid {stroke: #ddd;}
.mapGridLabel {fill: #333; font-size: 10px; font-family: Arial,Helvetica,sans-serif; dominant-baseline: central;}
</style>
</svg>
Insert cell
gridMapD3 = d3.select(gridMapContainer)
Insert cell
Insert cell
Insert cell
import {gridMap} from "@emfielduva/dvlib_maps"
Insert cell
Insert cell
Insert cell
usGridMapData = FileAttachment("usGridMapData.json").json()
Insert cell
gridOptions = ({
//topleft: [300,100],
//boxSize: 25,
labelField: "code",
boxRoundRad: 10
})
Insert cell
Insert cell
myGridMap = gridMap(gridMapD3,"usgrid",usGridMapData,gridOptions)
Insert cell
Insert cell
Insert cell
Insert cell
usPopulationData = FileAttachment("usstate_population2022.csv").csv()
Insert cell
import {toNum,colorByID} from "@emfielduva/dvlib"
Insert cell
colorScale = d3.scaleLinear().domain(d3.extent(usPopulationData,d => toNum(d.Pop2022))).range(["white","cyan"])
Insert cell
colorByID(myGridMap,usPopulationData,"state","State","Pop2022",'',colorScale)
Insert cell
colorByID
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