Published unlisted
Edited
Sep 25, 2020
Insert cell
Insert cell
Insert cell
chart
Insert cell
import {chart}
with {rolled_nest_data as data}
from "@d3/zoomable-sunburst"
Insert cell
rolled_nest_data = ({name: "Portfolio", children: nest(grouped_data)})
Insert cell
function nest(rollup) {
return Array.from(rollup, ([key, value]) =>
value instanceof Map
? { name: key, children: nest(value) }
: { name: key, value: value.length }
);
}
Insert cell
d3.hierarchy(grouped_data).sum(d => d.value).sort((a, b) => b.value - a.value);
Insert cell
hierarchy = d3.hierarchy(grouped_data)
Insert cell
rollup = d3.rollup(sovereign_projects.slice(1), d => d.length, d => d["Status"], d => d["Country"], d => d["Sector"])
Insert cell
rolled_data = d3.rollup(sovereign_projects.slice(1), d => d["Status"], d => d["Country"], d => d["Sector"])
Insert cell
grouped_data = d3.group(sovereign_projects.slice(1), d => d["Status"], d => d["Country"], d => d["Sector"])
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