Building a treemap

Treemaps were introduced by Ben Shneiderman in 1991. A treemap displays hierarchical tree-structured data as a set of recursively subdivided rectangles. In other words, it displays each branch of the tree as a large rectangle, which is then tiled with smaller rectangles representing subbranches. This process continuously repeats itself till it reaches the leaves of the tree.

Note

For more information on treemaps, refer to treemaps for space-constrained visualization of hierarchies by Ben Shneiderman at http://www.cs.umd.edu/hcil/treemap-history .

Before we dive into the code example, let's first define what we mean by hierarchical data. So far, we discussed many types of visualizations capable of representing flat data structure ...

Get Data Visualization with D3 4.x Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.