Public
Edited
Oct 4, 2022
Insert cell
Insert cell
Insert cell
Insert cell
maxOverallAgeAdjustedDeathRate = parseInt(dataset.filter(item=>item.state != 'United States').sort((a,b) => {return b.AADR-a.AADR})[0].AADR); //index 0 to get the item at the top of the sorted list (not including national total)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
//returns array of 3 point dataObjects for a specific state in a specific year
function getDeathData(state,year){
return dataset
.filter(item=>item.state == state)
.filter(item=>item.year == year)
.map((item)=>{
return {
cause: item.cause,
AADR: parseFloat(item.AADR),
deaths: parseInt(item.deaths)
}
})
.sort((a,b)=>{
return b.deaths -a.deaths
})
}
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
topojson = require("topojson-client@3")
Insert cell
path = d3.geoPath()
Insert cell
d3 = require("d3@5")

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