This layout algorithm applies geometric transformations to (sub-)graphs.
Remarks
Layout Style
There are several ways to transform the graph that include mirroring, rotating, scaling and translating.
45
degrees
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 SubgraphLayout needs to be enabled. Then the nodes in the subgraph must be marked in a IDataProvider registered with the according key.
Default Values of Properties
componentLayoutEnabled | false | The stage that arranges connected graph components is activated. |
hideGroupsStageEnabled | false | The stage responsible for hiding group nodes is activated. |
operation | SCALE
| |
parallelEdgeRouterEnabled | false | The stage that routes parallel edges is activated. |
preferredHeight | 1.0 | |
preferredWidth | 1.41 | |
rotationAngle | 0.0 | |
scaleFactorX | 1.0 | |
scaleFactorY | 1.0 | |
selfLoopRouterEnabled | false | The stage that routes self-loops is activated. |
subgraphLayoutEnabled | false | The stage that constrains the input graph to a subgraph is deactivated. |
translateX | 0.0 | |
translateY | 0.0 |
Type Details
- yfiles module
- layout-core
- yfiles-umd modules
- All layout modules, view-layout-bridge
- Legacy UMD name
- yfiles.layout.GraphTransformer
Constructors
Creates a new instance of GraphTransformer with default settings.
Parameters
A map of options to pass to the method.
- coreLayout - ILayoutAlgorithm
The core layout algorithm. This option sets the coreLayout property on the created object.
- operation - OperationType
The transformation operation. This option sets the operation property on the created object.
- rotationAngle - number
The angle of rotation. This option sets the rotationAngle property on the created object.
- bestFitRotationEnabled - boolean
Whether or not to automatically choose the best fitting rotation angle. This option sets the bestFitRotationEnabled property on the created object.
- preferredHeight - number
The preferred height of the layout. This option sets the preferredHeight property on the created object.
- preferredWidth - number
The preferred width of the layout. This option sets the preferredWidth property on the created object.
- scaleNodeSize - boolean
Whether or not to also scale node sizes when performing the scale operation. This option sets the scaleNodeSize property on the created object.
- scaleFactor - number
The uniform scaling factor used for the scale operation. This option sets the scaleFactor property on the created object.
- scaleFactorY - number
The vertical scaling factor used for the scale operation. This option sets the scaleFactorY property on the created object.
- scaleFactorX - number
The horizontal scaling factor used for the scale operation. This option sets the scaleFactorX property on the created object.
- translateX - number
The horizontal translation distance. This option sets the translateX property on the created object.
- translateY - number
The vertical translation distance. This option sets the translateY property on the created object.
- labeling - ILayoutStage
The ILayoutStage that places the labels of the input graph. This option sets the labeling property on the created object.
- selfLoopRouter - ILayoutStage
The ILayoutStage that routes self-loops. This option sets the selfLoopRouter property on the created object.
- parallelEdgeRouter - ILayoutStage
The ILayoutStage that routes parallel edges. This option sets the parallelEdgeRouter property on the created object.
- componentLayout - ILayoutStage
The ILayoutStage that arranges the connected components of an input graph. This option sets the componentLayout property on the created object.
- subgraphLayout - ILayoutStage
The ILayoutStage that constrains the layout process to a subgraph of the input graph. This option sets the subgraphLayout property on the created object.
- hideGroupsStage - ILayoutStage
The ILayoutStage that hides the group nodes of the input graph. This option sets the hideGroupsStage property on the created object.
- orientationLayout - ILayoutStage
The ILayoutStage that modifies the orientation of a computed layout. This option sets the orientationLayout property on the created object.
- orientationLayoutEnabled - boolean
Whether or not the ILayoutStage that modifies the orientation of the layout is activated. This option sets the orientationLayoutEnabled property on the created object.
- layoutOrientation - LayoutOrientation
The main orientation of the layout. This option sets the layoutOrientation property on the created object.
- selfLoopRouterEnabled - boolean
Whether or not the ILayoutStage used for routing self-loops is activated. This option sets the selfLoopRouterEnabled property on the created object.
- labelingEnabled - boolean
Whether or not the ILayoutStage used for placing the labels of the input graph is activated. This option sets the labelingEnabled property on the created object.
- hideGroupsStageEnabled - boolean
Whether or not the ILayoutStage used for hiding group nodes is activated. This option sets the hideGroupsStageEnabled property on the created object.
- componentLayoutEnabled - boolean
Whether or not the ILayoutStage used for arranging the components of the graph is activated. This option sets the componentLayoutEnabled property on the created object.
- parallelEdgeRouterEnabled - boolean
Whether or not the ILayoutStage used for routing parallel edges is activated. This option sets the parallelEdgeRouterEnabled property on the created object.
- subgraphLayoutEnabled - boolean
Whether or not the ILayoutStage used for constraining the layout process to a subgraph of the input graph is activated. This option sets the subgraphLayoutEnabled property on the created object.
Properties
Gets or sets whether or not to automatically choose the best fitting rotation angle.
Remarks
Default Value
false
.The layout is rotated by a specific angle.
See Also
Gets or sets the ILayoutStage that arranges the connected components of an input graph.
Default Value
ComponentLayout.See Also
Defined in
Gets or sets whether or not the ILayoutStage used for arranging the components of the graph is activated.
Remarks
Default Value(Overrides the default value defined in MultiStageLayout)
false
.The stage that arranges connected graph components is activated.
See Also
Defined in
Gets or sets the core layout algorithm.
Remarks
See Also
Implements
Gets or sets the ILayoutStage that hides the group nodes of the input graph.
Default Value
HideGroupsStage.See Also
Defined in
Gets or sets whether or not the ILayoutStage used for hiding group nodes is activated.
Remarks
Default Value(Overrides the default value defined in MultiStageLayout)
false
.The stage responsible for hiding group nodes is activated.
See Also
Defined in
Gets or sets the ILayoutStage that places the labels of the input graph.
Default Value
See Also
Defined in
Gets or sets whether or not the ILayoutStage used for placing the labels of the input graph is activated.
Remarks
Default Value
false
.The stage responsible for label placement is deactivated.
See Also
Defined in
Gets or sets the main orientation of the layout.
Remarks
Default Value
TOP_TO_BOTTOM.Throws
- Exception({ name: 'ArgumentError' })
- if the specified orientation does not match a default layout orientation
See Also
Defined in
Gets or sets the ILayoutStage that modifies the orientation of a computed layout.
Default Value
OrientationLayout.See Also
Defined in
Gets or sets whether or not the ILayoutStage that modifies the orientation of the layout is activated.
Remarks
Default Value
true
.The orientation
See Also
Defined in
Gets or sets the ILayoutStage that routes parallel edges.
Default Value
ParallelEdgeRouter.See Also
Defined in
Gets or sets whether or not the ILayoutStage used for routing parallel edges is activated.
Remarks
Default Value(Overrides the default value defined in MultiStageLayout)
false
.The stage that routes parallel edges is activated.
See Also
Defined in
Gets or sets the preferred height of the layout.
Remarks
This value will be used for fitting the rotation to preferred bounds.
The preferred height needs to be non-negative.
Default Value
1.0
.Throws
- Exception({ name: 'ArgumentError' })
- if the specified height is negative
See Also
Gets or sets the preferred width of the layout.
Remarks
This value will be used for fitting the rotation to preferred bounds.
The preferred width needs to be non-negative.
Default Value
1.41
.Throws
- Exception({ name: 'ArgumentError' })
- if the specified width is negative
See Also
Gets or sets the angle of rotation.
Remarks
Default Value
0.0
.See Also
Sets the uniform scaling factor used for the scale operation.
Remarks
This factor applies vertical and horizontal.
Only positive scaling factors are allowed.
Throws
- Exception({ name: 'ArgumentError' })
- if the specified scaling factor is negative or
0
See Also
Gets or sets the horizontal scaling factor used for the scale operation.
Gets or sets the vertical scaling factor used for the scale operation.
Gets or sets whether or not to also scale node sizes when performing the scale operation.
Default Value
false
.Nodes keep their sizes when the layout is scaled.
See Also
Gets or sets the ILayoutStage that routes self-loops.
Default Value
SelfLoopRouter.See Also
Defined in
Gets or sets whether or not the ILayoutStage used for routing self-loops is activated.
Remarks
Default Value(Overrides the default value defined in MultiStageLayout)
false
.The stage that routes self-loops is activated.
See Also
Defined in
Gets or sets the ILayoutStage that constrains the layout process to a subgraph of the input graph.
Default Value
SubgraphLayout.See Also
Defined in
Gets or sets whether or not the ILayoutStage used for constraining the layout process to a subgraph of the input graph is activated.
Remarks
Default Value
false
.The stage that constrains the input graph to a subgraph is deactivated.
See Also
Defined in
Gets or sets the horizontal translation distance.
Remarks
Default Value
0.0
.See Also
Gets or sets the vertical translation distance.
Remarks
Default Value
0.0
.See Also
Methods
Appends the given ILayoutStage to the layout pipeline.
Remarks
Parameters
A map of options to pass to the method.
- stage - ILayoutStage
- the ILayoutStage instance to be added
See Also
Defined in
Calculates a layout for the given graph and applies it directly to the graph.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
See Also
Implements
Applies the selected transformation to the given graph after invoking the optional core layout algorithm.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
Implements
Checks the sizes of the nodes to be non-zero.
Parameters
A map of options to pass to the method.
- g - LayoutGraph
- The graph to check.
Defined in
Deactivates all predefined ILayoutStages so that upon applyLayout only the layout algorithm will be executed.
See Also
Defined in
Specifies the preferred size of the layout.
Remarks
If performing a rotation and this rotation should be automatically fitted, then the given preferred size defines the aspect ratio that will be used for fitting the layout rotation.
The preferred width and height need to be non-negative.
Parameters
A map of options to pass to the method.
- width - number
- the preferred width of the layout
- height - number
- the preferred height of the layout
Throws
- Exception({ name: 'ArgumentError' })
- if the specified width or height is negative
See Also
Prepends the given ILayoutStage to the layout pipeline.
Remarks
Parameters
A map of options to pass to the method.
- stage - ILayoutStage
- the ILayoutStage instance to be added
See Also
Defined in
Removes the given ILayoutStage from the layout pipeline.
Remarks
Parameters
A map of options to pass to the method.
- stage - ILayoutStage
- a ILayoutStage to be removed from the layout pipeline
See Also
Defined in
Specifies the horizontal and vertical scaling factor used for the scale operation.
Remarks
Parameters
A map of options to pass to the method.
- xFactor - number
- the horizontal scaling factor
- yFactor - number
- the vertical scaling factor
Throws
- Exception({ name: 'ArgumentError' })
- if one the specified scaling factors is negative or
0
See Also
Static Methods
Rotates the given graph so its resulting bounding box fits best to the given bounds.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the graph that is rotated
- width - number
- the width of the preferred layout bounds
- height - number
- the height of the preferred layout bounds
Returns
- ↪number
- the rotation angle
See Also
Returns the rotation angle for the graph that will result in a layout that fits best to the given bounds.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the graph that is rotated
- width - number
- the width of the preferred layout bounds
- height - number
- the height of the preferred layout bounds
Returns
- ↪number
- the rotation angle
See Also
Fits the given graph into the specified rectangular bounds.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the graph to modify
- x - number
- the upper left x-coordinate of the bounds
- y - number
- the upper left y-coordinate of the bounds
- w - number
- the width of the bounds
- h - number
- the height of the bounds
Translates the layout coordinates by the given vector.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the graph that is translated
- dx - number
- the horizontal distance the given graph is moved
- dy - number
- the vertical distance the given graph is moved