Public
Edited
May 29, 2022
6 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
EndDate
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
mapDate = d3.utcFormat("%B %d %Y")(animScrubDate)
Insert cell
Insert cell
Insert cell
Insert cell
chartHeader = getKeyFromValue(valueOptionsMap, dataField)
Insert cell
Insert cell
Insert cell
nStates = stateAbbreviations.data.length
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
stateAbbreviationsByPctVaccinatedFeb22 = stateAbbreviations.data
.map((r) => ({
State: r.State,
PctVaccinated0222: r.PctVaccinated0222
}))
.sort((one, two) => two.PctVaccinated0222 - one.PctVaccinated0222)
Insert cell
Insert cell
Insert cell
Insert cell
stateIQFile = await FileAttachment("stateIQdata.json")
Insert cell
stateIQs = stateIQFile.json()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// margin = ({top: 20, right: 30, bottom: 30, left: 40})
Insert cell
Insert cell
Insert cell
AsOfDate = d3.utcFormat("%B %d")(EndDate)
Insert cell
Insert cell
EndDate
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
EndDate
Insert cell
animDuration = 1000 / framesPerSecond
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
tableau10 = ["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
voted2020Names = ["Biden", "Trump"]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
PctHispanicBucketNames = genNamesArray(" in % Hispanic")
Insert cell
Insert cell
Insert cell
PctAsianBucketNames = genNamesArray(" in % Asian")
Insert cell
Insert cell
PctVaccinatedBucketNames = genNamesArray(" in % fully vaccinated")
Insert cell
Insert cell
leansNames = ["Trump by 30%+", "Trump by 10-29%", "Trump by <10%", "Biden by <10%", "Biden by 10-29%", "Biden by 30%+"]
Insert cell
Insert cell
Insert cell
theAggregator = theAggregators[aggregatorRadio]
Insert cell
aggregatorRadio
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
test = d3.rgb(theColorScheme.range[0])
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
animDuration
Insert cell
Insert cell
Insert cell
Insert cell
barchartxaxis = `${chartTitle} on ${d3.utcFormat("%B %d, %Y")(animScrubDate)}`
Insert cell
animBarChartxaxis = `${chartTitle} on ${d3.utcFormat("%B %d")(
animDate)}`
Insert cell
barScrubChartTitle = `${chartTitle} ${getCurAggRadioLabel} on ${d3.utcFormat(
"%B %d %Y"
)(animScrubDate)}`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
lastChartDay = d3.timeDay.count(EndDate, animDate) > 0 ? EndDate : animDate ;

Insert cell
EndDate
Insert cell
numberOfDays = d3.timeDay.count(date1, EndDate);
Insert cell
Insert cell
Insert cell
path = d3.geoPath()
Insert cell
topojson = require("topojson-client@3")
Insert cell
us = FileAttachment("states-albers-10m.json").json()
Insert cell
Insert cell
Insert cell
// rankPartType = parseInt(strRankPartitionsFunction)
Insert cell
Insert cell
testNames = genNamesArray( " % Evangelicals")
Insert cell
PctEvangelicalBucketNames
Insert cell
Insert cell
Insert cell
Insert cell
xMap = genRankMap(rankingCategories)
Insert cell
foo = getCategoryIndex(25)
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