Forked 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.
https://d3js.org/d3.v4.min.js