Public
Edited
Dec 11, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
cantonPopulationBy2020 = {
const temp = sheet.map(d => ({
id: d.Código.toString(),
name: d["Nombre de canton"],
value: d["2020"]
}))
return temp.map(d => ({
cantonId: d.id.length < 4 ? "0" + d.id : d.id,
cantonName: d.name,
population: d.value
}))
}
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
pieChart(donutData, donutColorScale)
Insert cell
Insert cell
Insert cell
Insert cell
barChart(barData, barColorScale)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
pieChart(donutSexData, donutSexColorScale)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
pieChart(donutAgeData, donutAgeColorScale)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
parishes = topojson.feature(ec, ec.objects.level4)
Insert cell
cantons = topojson.feature(ec, ec.objects.level3)
Insert cell
provinces = topojson.feature(ec, ec.objects.level2)
Insert cell
provincemap = new Map(provinces.features.map(d => [d.id, d]))
Insert cell
provinceMesh = topojson.mesh(ec, ec.objects.level2)//, (a, b) => a!== b)
Insert cell
nation = topojson.mesh(ec, ec.objects.level1)
Insert cell
md`### recent test`
Insert cell
data
Insert cell
// missed people by raw data
new Map(Array.from(d3.rollup(data, g => g.length, d => d.state)).sort((a, b) => b[1] - a[1]))
Insert cell
new Map(Array.from(d3.rollup(data, g => g.length, d => d.province)).sort((a, b) => b[1] - a[1]))
Insert cell
Insert cell
//parishes.features[2].geometry.coordinates[0] // level.features[].geometry.coordinates[0]
//cantons.features[17].geometry.coordinates[0][0]// level.features[].geometry.coordinates[0][0]
provinces.features[17].geometry.coordinates// level.features[].geometry.coordinates
Insert cell
cantonPopulationBy2020.filter(d => d.cantonId === "1909")
Insert cell
point = [1.5, 1.00001]
Insert cell
color = d3.scaleSequential([1, 10], d3.interpolateReds);
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
//color1 = d3.scaleSequential([1, 10], d3.interpolateReds)
Insert cell
Legend(color, {title: 'employment', width: 260})
Insert cell
Insert cell
Insert cell
height = width * 0.625
Insert cell
width
Insert cell
import {Legend} from "@d3/color-legend"
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