C

LayoutTransformations

Provides factory methods to create ILayoutStages for transforming a LayoutGraph.
Inheritance Hierarchy

Remarks

Layout Style

This class allows creating layout stages that apply various geometric transformations such as mirroring, rotating, translating, and scaling to the layout of a graph.

The highlighted subgraph is rotated by 45 degrees

The layout stages apply the transformations after applying their core layout.

Features

The layout can be scaled with independent factors for the horizontal and vertical scaling. Optionally, the sizes of nodes can be scaled, too.

The layout can be mirrored either on the x-axis or the y-axis.

A rotation can be specified. Instead of defining a rotation angle, the angle can be determined automatically to fit specific bounds.

The coordinates in the layout can be translated by a specific vector.

To only apply previously mentioned transformations to a subgraph, the SubgraphLayoutStage needs to be enabled. Then the nodes in the subgraph must be defined by using property subgraphNodes.

Members

No filters for this type

Static Methods

Creates an ILayoutStage that rotates the LayoutGraph to best fit the given preferredAspectRatio.

The angle is determined automatically to fit the specified preferredAspectRatio.

The graph will be rotated after applying the core layout of the stage.

static

Parameters

preferredAspectRatio?: Size
The preferred aspect ratio for the best fit rotation. Defaults to 1.41:1 if not specified.

Return Value

ILayoutStage
A layout stage that rotates the graph.
Creates an ILayoutStage that mirrors the LayoutGraph.
The graph will be mirrored after applying the core layout of the stage.
static

Parameters

xAxis: boolean
If true, the graph is mirrored on the x-axis. Otherwise, it is mirrored on the y-axis.
offset?: number
An optional offset of the axis of rotation from the graph's center.

Return Value

ILayoutStage
A layout stage that mirrors the graph.
Creates an ILayoutStage that rotates the LayoutGraph clockwise by a given rotationAngle.

The graph will be rotated clockwise around the center of its bounds.

The graph will be rotated after applying the core layout of the stage.

static

Parameters

rotationAngle: number
The angle in degrees by which to rotate the graph clockwise around the center of the graph's bounds.
rotationCenter?: Point
Possibility to specify the center of rotation. If omitted, the graph will be rotated around its center.

Return Value

ILayoutStage
A layout stage that rotates the graph.
Creates an ILayoutStage that scales the LayoutGraph.
The graph will be scaled after applying the core layout of the stage.
static

Parameters

scaleFactorX?: number
The factor by which to scale the graph horizontally.
scaleFactorY?: number
The factor by which to scale the graph vertically.
scaleNodeSize?: boolean
If true, the sizes of nodes are scaled as well.
scalingCenter?: Point
Possibility to specify the center of scaling. If omitted, the graph will be scaled from its center.

Return Value

ILayoutStage
A layout stage that scales the graph.
Creates an ILayoutStage that translates the LayoutGraph.

The graph will be translated after applying the core layout of the stage.

Note that if a LayoutGrid is present, it will not be adjusted by this stage. The client code is responsible for shifting the LayoutGrid if necessary. This adjustment is only relevant if the entire graph is being moved, not just a subset.

Moving a LayoutGrid by delta.
layoutGrid.columns.forEach((column) => (column.position += dx))
layoutGrid.rows.forEach((row) => (row.position += dy))
static

Parameters

translateX?: number
The distance to translate the graph along the x-axis.
translateY?: number
The distance to translate the graph along the y-axis.
affectedNodes?: ILinkedItemEnumerable<LayoutNode>
The nodes to be translated. If omitted, all nodes are translated.

Return Value

ILayoutStage
A layout stage that translates the graph.