Published
Edited
Nov 8, 2020
Fork of Hierarchies
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
data = d3.csvParse(await FileAttachment("pokemon.csv").text()).slice(0, 100)
Insert cell
render_data_table(data.slice(0, 10))
Insert cell
Insert cell
Insert cell
nested = d3
.nest()
.key(d => d.type1)
.entries(data)
Insert cell
hierarchy = d3.hierarchy(
{ name: 'Pokemon Type', values: nested },
d => d.values
)
Insert cell
make_treemap_layout = d3
.treemap()
.tile(d3.treemapResquarify)
.size([width, height])
.padding(0)
Insert cell
height = 600
Insert cell
color = d3
.scaleOrdinal()
.domain(nested.map(d => d.key))
.range(d3.schemePastel1)
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
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
d3 = require("d3")
Insert cell
import { select } from "@jashkenas/inputs"
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