block by mbostock b4c0f143db88a9eb01a315a1063c1d77

Treemap by Count

Full Screen

This example demonstrates how to create a treemap where each leaf node is treated as having equal value, rather than being sized according to a quantitative property.

In the flare.csv file, leaf nodes (representing class source files) have a non-zero value, while internal nodes (representing packages) have a zero value. Thus, when calling node.sum, any non-zero value can be treated as one:

root.sum(function(d) { return d.value ? 1 : 0; });

If you instead give all nodes a value of one, then one unit of additional space will be reserved for the parent.

Updated Example →