O'Reilly logo

Learning d3.js Data Visualization - Second Edition by Swizec Teller, Ændrew Rininsland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hierarchical layouts

All hierarchical layouts are based on an abstract hierarchy layout designed for representing hierarchical data—data within data within data within data within.... all the way down. As mentioned earlier, imagine a tree, or an org chart if you don't go outside very much.

All of the common code for the partition, tree, cluster, pack, and treemap layouts is defined in d3.layout.hierarchy(), and they all follow similar design patterns. The layouts are so similar that the official documentation very obviously copy-pastes most of its explanations which are practically identical. Let's avoid that by looking at the common stuff first, and then we will focus on the differences.

First of all, we need some hierarchical data. There's an ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required