Published
Edited
Oct 30, 2019
Fork of Untitled
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
data = d3.json("https://raw.githubusercontent.com/jsprieto10/json_echo/master/sunburst.json?token=AE6V7SYFYHIAJMPRX7E24GC5DWGDQ")
Insert cell
partition = data => {
const escala = d3.scalePow().exponent(0.5);
const root = d3.hierarchy(data)
.sum(d => escala(d.value))
.sort((a, b) => b.value - a.value);
return d3.partition()
.size([2 * Math.PI, root.height + 1])
(root);
}
Insert cell
color = d3.scaleOrdinal(d3.quantize(d3.interpolateRainbow, data.children.length + 1))
Insert cell
format = d3.format(",d")
Insert cell
radius = width / 6
Insert cell
arc = d3.arc()
.startAngle(d => d.x0)
.endAngle(d => d.x1)
.padAngle(d => Math.min((d.x1 - d.x0) / 2, 0.005))
.padRadius(radius * 1.5 + 1000)
.innerRadius(d => d.y0 * radius)
.outerRadius(d => Math.max(d.y0 * radius, d.y1 * radius - 1))
Insert cell
ods = ({
"ods_1": { "name": "Fin de la pobreza", "color": "rgb(231, 56, 65)" },
"ods_2": { "name": "Hambre cero", "color": "rgb(224, 164, 60)" },
"ods_3": { "name": "Salud y bienestar", "color": "rgb(78, 160, 73)" },
"ods_4": { "name": "Educación de calidad", "color": "rgb(200, 46, 51)" },
"ods_5": { "name": "Igualdad de género", "color": "rgb(236, 63, 51)" },
"ods_6": { "name": "Agua limpia y saneamiento", "color": "rgb(77, 191, 234)" },
"ods_7": { "name": "Energía asequible y no contaminante", "color": "rgb(248, 195, 70)" },
"ods_8": { "name": "Trabajo y crecimiento económico", "color": "rgb(167, 40, 70)" },
"ods_9": { "name": "Industria, innovación e infraestructura", "color": "rgb(239, 105, 55)" },
"ods_10": { "name": "Reducción de las desigualdades", "color": "rgb(224, 58, 104)" },
"ods_11": { "name": "Ciudades y comunidades sostenible", "color": "rgb(244, 157, 63)" },
"ods_12": { "name": "Producción y consumo responsables", "color": "rgb(191, 138, 50)" },
"ods_13": { "name": "Acción por el clima", "color": "rgb(67, 126, 74)" },
"ods_14": { "name": "Vida submarina", "color": "rgb(54, 150, 215)" },
"ods_15": { "name": "Vida de ecosistemas terrestres", "color": "rgb(93, 184, 72)" },
"ods_16": { "name": "Paz, justicia e instituciones sólidas", "color": "rgb(35, 105, 157)" },
"ods_17": { "name": "Alianzas para lograr los objetivos", "color": "rgb(21, 71, 108)" }
});
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