Skip to main content

Function: squarify()

squarify(areas, region): TreemapRect[]

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

Partition region into one rectangle per area, in input order.

The areas must already be scaled so their sum equals the region area. The result tiles the region exactly (no gaps, no overlap) when the areas are positive. A zero area yields a zero-size rectangle at the current corner.

Parameters​

areas​

number[]

Target areas, best supplied in descending order.

region​

TreemapRect

The rectangle to fill.

Returns​

TreemapRect[]

One rectangle per area, aligned to the areas index.