5. Lay out Objects

We get a collection of graphical objects after applying repeat, divide or densify operations. These objects 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 repeat or divide operations:

scene.divide(rect, table, {attribute: "col", layout: tl});