Rectangular and order-preserving layouts

By default FoamTree lays out the input groups as polygons in the order of increasing weights. Sometimes, however, it may be desirable to preserve the order of groups presented in the input data object.

One way to preserve the input order is to set the layout option to ordered, which will cause FoamTree to lay out the groups as polygons in the left-to-right, top-to-bottom fashion.

Alternatively, to lay out the groups as polygons approximately in the left-to-right arrangement, set layout to relaxed and relaxationInitializer to ordered. How closely the original order will be preserved depends on how imbalanced group weights are. The lower the variance of the weights, the better the order will be preserved.

Using the experiments section below, you can see how well the original order of groups will be preserved with different layout and initializer settings. To make order preservation judgments easier, this example sets a custom groupColorDecorator to vary the lightness of the polygon depending on the position in the data object.


Generate new data with uniform | balanced | unbalanced weights.
Set layout to ordered | squarified.
Set group shapes to rectangles | polygons.

What's in the code?