D3 provides several layout functions that transform hierarchical data structures by adding properties and methods that facilitate their rendering as hierarchical visualizations. While D3 doesn't automatically generate hierarchical charts, it computes coordinates, angles, distances, and other values that can easily be bound to properties of SVG circles, rectangles, lines, curves, and text, using the general update pattern.
A hierarchical dataset is a recursive structure that contains objects that link to a parent node and an array of child nodes. Nodes that have no children are leaf nodes; the root node has a null parent. We created some hierarchical structures in Chapter 4, Data Binding with the d3.nest() and d3.group() functions. Layout functions for hierarchical visualizations provided by D3 require a specific format for the hierarchical data, and expect...