Skip to main content

Transforming Layouts

Layout transformations modify an existing layout, such as by repositioning elements to avoid overlaps.

Avoiding overlaps

Jittering

Randomly perturb positions.

AttributeTypeDescription
type"jitter"
x?numberx-coordinate may be altered by $-x/2 < = dx < = x/2$
y?numbery-coordinate may be altered by $-y/2 < = dy < = y/2$

1D Offset to avoid overlap

Offset positions of elements (either horizontally or vertically) to avoid overlap.Minimises the sum-of-squares of displacements.

AttributeTypeDescription
type"offset"
direction"vertical" or "horizontal"Which direction to offset positions in.
width?numberMaximise width (or height) within which offset elements should fit.
minSpacing?numberMinimum spacing between adjacent elements.
condition?stringIf set, elements for which this expression evaluates to false will be ignored.

Beeswarm

Apply a Beeswarm transformation, by doing a force-based simulation in which elements are attracted to their original positions, but also pushed apart by a collision force.

AttributeTypeDescription
type"beeswarm"
gravityX?numberStrength of horizontal force pulling nodes to their original position (default: 0.1).
gravityY?numberStrength of vertical force pulling nodes to their original position (default: 0.1).
collisionStrength?numberStrength of force avoiding overlaps (default: 1)
collisionStrength?numberStrength of force avoiding overlaps (default: 1)

Other

Translation

Apply a x or y translation of the elements of the layouts.

AttributeTypeDescription
type"translate"
x?numberAmplitude of the horizontal translation
y?numberAmplitude of the horizontal translation

Set position

Set x/y/width/height of elements in a layout.

AttributeTypeDescription
type"set"
field"width" or "height" or "x"or "y"Which field to set.
valuenumberNew value to assign to field.

Move target of links to align horizontally with source.

AttributeTypeDescription
direction"vertical" or "horizontal"Direction in which to orient links.
networkstringThe network containing the links.
networkstringThe network containing the links.