Provides factory methods to create ILayoutStages for transforming a LayoutGraph.
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.
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.
Type Details
- yFiles module
- algorithms
Static Methods
Creates an ILayoutStage that rotates the LayoutGraph to best fit the given preferredAspectRatio.
Remarks
The angle is determined automatically to fit the specified preferredAspectRatio.
The graph will be rotated after applying the core layout of the stage.
Parameters
A map of options to pass to the method.
- preferredAspectRatio - Size
- The preferred aspect ratio for the best fit rotation. Defaults to
1.41:1if not specified.
Returns
- ↪ILayoutStage
- A layout stage that rotates the graph.
Creates an ILayoutStage that mirrors the LayoutGraph.
Remarks
Parameters
A map of options to pass to the method.
- 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.
Returns
- ↪ILayoutStage
- A layout stage that mirrors the graph.
Creates an ILayoutStage that rotates the LayoutGraph clockwise by a given rotationAngle.
Remarks
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.
Parameters
A map of options to pass to the method.
- 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.
Returns
- ↪ILayoutStage
- A layout stage that rotates the graph.
createScalingStage
(scaleFactorX?: number, scaleFactorY?: number, scaleNodeSize?: boolean, scalingCenter?: Point) : ILayoutStageCreates an ILayoutStage that scales the LayoutGraph.
Remarks
Parameters
A map of options to pass to the method.
- 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.
Returns
- ↪ILayoutStage
- A layout stage that scales the graph.
createTranslationStage
(translateX?: number, translateY?: number, affectedNodes?: ILinkedItemEnumerable<LayoutNode>) : ILayoutStageCreates an ILayoutStage that translates the LayoutGraph.
Remarks
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.
layoutGrid.columns.forEach((column) => (column.position += dx))
layoutGrid.rows.forEach((row) => (row.position += dy))Parameters
A map of options to pass to the method.
- 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.
Returns
- ↪ILayoutStage
- A layout stage that translates the graph.