Public
Edited
Nov 6, 2020
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
parsedData = ({
name: "root",
children: rawData.map(d => {
const name = d["title"]
const processChildren = (children=[]) => {
return children.map(d => ({
name: (d["name"] || d["title"] || "").split(" - ")[0],
children: processChildren(d["children"]),
value: (d["children"] || []).length,
value: d["size"] || d["value"] || (d["children"] ? sum(d["children"].map(d => d["value"])): 1),
}))
}
return {name, children: processChildren(d["children"]), value: d["size"] || d["value"]}
})
})
Insert cell
Insert cell
circlePack
Insert cell
circlePackPack = data => d3.pack()
.size([width, 975])
.padding(3)
(d3.hierarchy(parsedData)
.sum(d => 1))
Insert cell
import {chart as circlePack} with {
parsedData as data,
} from "@d3/circle-packing-monochrome"
Insert cell
treemap
Insert cell
import {chart as treemap} with {
parsedData as data
} from "@d3/treemap-by-count"
Insert cell
// tidyTree
Insert cell
import {chart as tidyTree} with {
parsedData as data
} from "@d3/tidy-tree"
Insert cell
bubbleChart
Insert cell
bubbleChartData = parsedData["children"].map(({children, ...d}) => ({...d, group: d["name"]}))
Insert cell
import {chart as bubbleChart} with {
bubbleChartData as data
} from "@d3/bubble-chart"
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

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