Published
Edited
Aug 26, 2019
3 forks
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
treemap = data => cascade(
d3.treemap()
.size([treemapDims.width, treemapDims.height])
.paddingTop(treemapDims.paddingTop)
.paddingInner(0)
.round(true)
.tile(d3.treemapResquarify)
(d3.hierarchy(data)
.sum(d => d.value)
.sort((a, b) => b.height - a.height)),
offset // treemap.paddingOuter
)
Insert cell
Insert cell
offset = 15
Insert cell
width = 975
Insert cell
height = 800
Insert cell
treemapDims = ({
width: width/2,
height: height/2,
paddingTop: 15
})
Insert cell
format = d3.format(",d")
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