Summary
That wraps it up for this chapter on visualizing hierarchical data. With D3, we can easily visualize this kind of data through different visualizations. Once you've got your data, you first need to create a nested structure of it. D3 offers helper functions for this (d3.nest
and d3.stratify
) that take care of converting row-based data to a structure that can be passed into the chart functions (such as tree
and treemap
). We've also seen that not all data can be visualized properly with the available visualizations. The normal tree
works well for visualizing trees, but can quickly result in very large charts. Luckily, D3 offers a d3.zoom
function, which allows you to pan and zoom around the chart. We've also seen that by changing how the x
and y
coordinates are projected, we can quickly change the way the chart looks. With our radial tree, we showed that large tree structures can be visualized in a concise way. We've also made the charts interactive and more visually appealing by adding...