Public
Edited
Jul 14, 2024
Importers
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
tree = data => {
const root = d3.hierarchy(data);
root.dx = 10;
root.dy = width / (root.height + 1);
let layout;
switch (algorithm) {
case "cluster": layout = d3.cluster(); break;
case "cluster-no-separation": layout = d3.cluster().separation(() => 1); break;
case "tree": layout = d3.tree(); break;
}
return layout.nodeSize([root.dx, root.dy])(root);
}
Insert cell
width = 954
Insert cell
import {rasterize, serialize} from "@mbostock/saving-svg"
Insert cell
import {cstParseRows} from "@mbostock/comma-separated-tree"
Insert cell
d3 = require("d3@5")
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