5. Lay out Objects

We often get a collection of graphical objects after applying repeat or divide operations. These collections can be positioned using layouts. Mascot currently provides the following types of layout: grid, stack, packing, and treemap.

To create a layout, use the layout function, for example,

let tl = msc.layout("treemap", {width: 800, height: 500});

A layout can only be applied to a collection:

collection.layout = tl;

You can also pass a layout as an argument when performing the repeat operation:

let collection = msc.repeat(rect, table, {attribute: "col", layout: tl});