Public
Edited
Nov 30, 2022
Fork of Simple D3
Insert cell
Insert cell
import {Pack} from "@d3/pack"
Insert cell
data = [{"a":1, "b":2}, {"a":1, "b":2}, {"a":1, "b":2}, {"a":1, "b":2}, {"a":1, "b":2}, {"a":1, "b":2}]
Insert cell
rollup = d3.rollup(
data
)
Insert cell
chart = Pack(rollup, {
value: ([, value]) => value,
label: ([key]) => key?.split(/\s+/g).join("\n"),
title: ([key], n) => `${n.depth
? `${n.ancestors().reverse().slice(1).map(({data: [key]}) => key).join("\n")}\n`
: ""}${n.value.toLocaleString("en")}`,
width: 2000,
height: 2000,
})
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