Skip to main content

Function: computeTreemapLayout()

computeTreemapLayout(root, region, padding): TreemapTile[]

Defined in: src/mobjects/graphing/treemapLayout.ts:220

Compute the full treemap layout for a hierarchy.

The root fills region. Each internal node's children tile the node's rectangle, inset by padding so a parent border stays visible. With padding 0 the leaves partition the region exactly.

The function never throws. An empty hierarchy still returns the root tile.

Parameters​

root​

TreemapNode

The root node.

region​

TreemapRect

The rectangle the root fills.

padding​

number = 0

Inset applied before laying out each node's children.

Returns​

TreemapTile[]

Tiles in pre-order (root first), one per node.