Skip to content

Static layouts

Static layouts compute node positions once, with no simulation. Orb has three. Switch between them (and force) here:

Circular

Nodes evenly spaced around a circle.

typescript
orb.setSettings({ layout: { type: 'circular', options: { radius: 200 } } });
OptionDefaultDescription
radius100Circle radius.
centerX0Circle center x.
centerY0Circle center y.

Grid

Nodes on a regular grid, filled row by row.

typescript
orb.setSettings({ layout: { type: 'grid', options: { rowGap: 60, colGap: 60 } } });
OptionDefaultDescription
rowGap50Vertical spacing between rows.
colGap50Horizontal spacing between columns.

Hierarchical

Tree-like, arranged in levels - good for graphs with a clear parent/child structure.

typescript
orb.setSettings({
  layout: { type: 'hierarchical', options: { orientation: 'horizontal' } },
});
OptionDefaultDescription
nodeGap50Spacing between sibling nodes.
levelGap50Spacing between levels.
treeGap100Spacing between separate trees (disconnected components).
orientation'vertical''vertical' (levels top-to-bottom) or 'horizontal' (left-to-right).
reversedfalseFlip the level order.

TIP

All layouts also accept anchorX / anchorY ('start' | 'center' | 'end') to control where the result is anchored in the view.

Released under the Apache-2.0 License.