Public
Edited
Feb 17, 2023
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
getNum = (d, data, yScale, type) => {
if(d === 80) {
return data[`${type} 80 Years old & over`]
}
else {
return data[`${type} ${d}-${d+4} Years old`]
? data[`${type} ${d}-${d+4} Years old`]
: data[`${type} ${d}-${d+4} years old`]
}
}
Insert cell
getYNum = (d, data, yScale, type) => {
if(d === 80) {
return yScale(data[`${type} 80 Years old & over`])
}
else {
return yScale(data[`${type} ${d}-${d+4} Years old`])
? yScale(data[`${type} ${d}-${d+4} Years old`])
: yScale(data[`${type} ${d}-${d+4} years old`])
}
}
Insert cell
malePopMax = d3.max(raw_data, d => d3.max(Object.values(d)))
Insert cell
ageRange2 = Array.from(Array(9).keys()).map(d => d * 10)
Insert cell
ageRange = Array.from(Array(17).keys()).map(d => d * 5)
Insert cell
Object.values(raw_data[0]);
Insert cell
Insert cell
Insert cell
Insert cell
raw_data = d3.csvParse(await FileAttachment("Projected_Population_by_Age_Korea - Sheet2.csv").text(), d3.autoType)
Insert cell
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