Public
Edited
Feb 12, 2023
Insert cell
Insert cell
chart = Tree(flare, {
label: d => (Math.round(d.area * 10) / 10).toFixed(1),
title: (d, n) => `${n.ancestors().reverse().map(d => d.data.name).join(".")}`, // hover text
link: (d, n) => `https://github.com/prefuse/Flare/${n.children ? "tree" : "blob"}/master/flare/src/${n.ancestors().reverse().map(d => d.data.name).join("/")}${n.children ? "" : ".as"}`,
sort: (a, b) => d3.descending(a.height, b.height), // reduce link crossings
tree: d3.cluster,
width: 400
})
Insert cell
flare = FileAttachment("4_subdiv").json()
Insert cell
chart1 = Tree(tree2, {
label: d => (Math.round(d.area * 10) / 10).toFixed(1),
title: (d, n) => `${n.ancestors().reverse().map(d => d.data.name).join(".")}`, // hover text
link: (d, n) => `https://github.com/prefuse/Flare/${n.children ? "tree" : "blob"}/master/flare/src/${n.ancestors().reverse().map(d => d.data.name).join("/")}${n.children ? "" : ".as"}`,
sort: (a, b) => d3.descending(a.height, b.height), // reduce link crossings
tree: d3.cluster,
width: 500
})
Insert cell
tree2 = FileAttachment("tree2.json").json()
Insert cell
chart3 = Tree(tree3, {
label: d => (Math.round(d.area * 10) / 10).toFixed(1),
title: (d, n) => `${n.ancestors().reverse().map(d => d.data.name).join(".")}`, // hover text
link: (d, n) => `https://github.com/prefuse/Flare/${n.children ? "tree" : "blob"}/master/flare/src/${n.ancestors().reverse().map(d => d.data.name).join("/")}${n.children ? "" : ".as"}`,
sort: (a, b) => d3.descending(a.height, b.height), // reduce link crossings
tree: d3.cluster,
width: 250,
})
Insert cell
tree3 = FileAttachment("2_Room.json").json()
Insert cell
Insert cell
import {Tree} from "@d3/tree"
Insert cell
import {howto} from "@d3/example-components"
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