Published
Edited
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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more