Published
Edited
Jan 17, 2022
1 fork
Insert cell
# Balanced Tree Visualizer
Insert cell
viewof width = Inputs.range([0, 174], { step: 1, label: "Width", value: 3 })
Insert cell
viewof leaves = Inputs.range([0, 500], { step: 1, label: "Leaves", value: 10 })
Insert cell
tree = Tree(result.root, {
label: (d) => d.cid || `root-${d.id}`
})
Insert cell
builder = open({}, { width: 3 })
Insert cell
wrote = write(builder, chunks)
Insert cell
result = close(wrote)
Insert cell
chunks = [...range(1, leaves)].map((n) => ({ cid: `bafy..h${n}` }))
Insert cell
Insert cell
import { Tree } from "@d3/tree"
Insert cell
import { open, close, write } from "@gozala/balanced-tree-layout"
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