Public
Edited
Dec 2, 2022
Insert cell
Insert cell
chart = Pack(hier, {
value: (d) => d.value,
label: (d) => d.data.name,
title: (d, n) => `${n.depth
? `${n.ancestors().reverse().slice(1).map(({data}) => data.data.name).join("\n")}\n`
: ""}${n.value.toLocaleString("en")}`,
width: 2000,
height: 2000,
})
Insert cell
hier = d3.hierarchy(data).count()
Insert cell
data = {
"key": "root",
"children": []
}
Insert cell
import {Pack} from "@d3/pack"
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