Public
Edited
Dec 6, 2022
1 fork
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
height = 1080
Insert cell
width = 1920
Insert cell
lineHeight = 40
Insert cell
Insert cell
pack = data => d3.pack()
.size([width, height])
.padding(5)
(d3.hierarchy(data)
.sum(d => d.value)
.sort((a, b) => b.value - a.value))
Insert cell
color = d3.scaleLinear()
.domain([0, 5])
.range(["hsl(152,80%,80%)", "hsl(228,30%,40%)"])
.interpolate(d3.interpolateHcl)
Insert cell
function buildTree(nodes, links) {
// https://stackoverflow.com/a/68209716
const map = new Map(nodes.map((o) => [o.name, { ...o, children: [] }]));
for (let { source, target } of links)
map.get(source).children.push(map.get(target));
return map;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
raw = {
const text = await FileAttachment(
"RWS_Organisatiestructuur_source_target@1.csv"
).text();
return d3.dsvFormat(";").parse(text);
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
d3 = require("d3@6")
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