This ITreeLayoutNodePlacer places the subtrees such that the overall aspect ratio of the arranged subtree will be close to a preferred aspect ratio.
Remarks
Layout Style
The aspect ratio describes the relation between width and height of the subtree. To achieve the desired aspect ratio, this ITreeLayoutNodePlacer divides the child SubtreeShapes into as much rows as needed. The edges are either routed along the rows or along the columns.
1
0.5
2
Default Values of Properties
aspectRatio | 1 | |
fillStyle | LEADING
| |
horizontal | false | The child nodes are placed in vertical columns. |
horizontalDistance | 40 | |
verticalDistance | 40 |
Type Details
- yfiles module
- layout-tree
- yfiles-umd modules
- layout-orthogonal-compact, layout-orthogonal, layout-tree, layout
- Legacy UMD name
- yfiles.tree.AspectRatioNodePlacer
See Also
Constructors
Creates a new instance of AspectRatioNodePlacer with default settings.
Parameters
A map of options to pass to the method.
- horizontal - boolean
Whether child nodes are distributed in horizontal rows or vertical columns. This option sets the horizontal property on the created object.
- verticalDistance - number
The vertical distance between the SubtreeShapes. This option sets the verticalDistance property on the created object.
- horizontalDistance - number
The horizontal distance between the SubtreeShapes. This option sets the horizontalDistance property on the created object.
- aspectRatio - number
The preferred aspect ratio (width/height) for the subtrees. This option sets the aspectRatio property on the created object.
- fillStyle - FillStyle
How rows/columns are aligned with each other. This option sets the fillStyle property on the created object.
Properties
Gets or sets the preferred aspect ratio (width/height) for the subtrees.
Remarks
This ratio determines among how many rows/columns the nodes will be distributed.
The aspect ratio needs to be positive.
Default Value
1
.Throws
- Exception({ name: 'ArgumentError' })
- if the specified aspect ratio is
0
or negative
Sample Graphs
Gets or sets the horizontal distance between the SubtreeShapes.
Remarks
The nodes will be placed next to each other, keeping this distance.
The distance needs to be non-negative.
Default Value
40
.Throws
- Exception({ name: 'ArgumentError' })
- if the specified distance is negative
Sample Graphs
Gets or sets the vertical distance between the SubtreeShapes.
Remarks
The nodes will be placed below each other, keeping this distance.
The distance needs to be non-negative.
Default Value
40
.Throws
- Exception({ name: 'ArgumentError' })
- if the specified distance is negative
Sample Graphs
Methods
Returns a clone of this ITreeLayoutNodePlacer instance.
Creates an edge IComparer<T> which takes the initial coordinates of the nodes into account.
Remarks
Returns
- ↪IComparer<any>
- the IComparer<T> for the edges
Implements
Creates an optional IProcessor for pre- and post-processing.
Remarks
null
. Hence, no pre- or post-processing will be done.Parameters
A map of options to pass to the method.
- layouter - TreeLayout
- the current TreeLayout instance
- graph - LayoutGraph
- the input graph
- currentRoot - YNode
- the root node handled by this ITreeLayoutNodePlacer
Returns
- ↪IProcessor
null
Implements
Determines a connector direction for the given child node depending on whether or not the child nodes are arranged horizontally.
Provides the direction of the connector to the SubtreeShape for each child node.
Remarks
Parameters
A map of options to pass to the method.
- localRoot - YNode
- the local root node
- connectorMap - IDataMap
- the map that must be used for storing the direction specifiers of the child nodes
Domain YNode a child node of the local root Values number the direction specifier assigned to the child node
Implements
Returns the SubtreeShape for the given node.
Remarks
This is a convenience method that retrieves a SubtreeShape for a single node from the corresponding IDataProvider.
This method is used in placeSubtreeOfNode for retrieving the SubtreeShapes for the local root nodes. It may be overridden to return a custom implementation of SubtreeShape.
Parameters
A map of options to pass to the method.
- node - YNode
- the node
Returns
- ↪SubtreeShape
- the SubtreeShape for the given node
Defined in
Returns the SubtreeShape for the subtree rooted at the given node.
Remarks
This is a convenience method that retrieves a SubtreeShape of a complete subtree from the corresponding IDataProvider.
This method is used in placeSubtreeOfNode for retrieving the SubtreeShapes for the subtrees that are arranged. It may be overridden to return a custom implementation of SubtreeShape.
Parameters
A map of options to pass to the method.
- node - YNode
- the local root node
Returns
- ↪SubtreeShape
- the SubtreeShape of the subtree rooted at the given local root node
Defined in
placeSubtree
(nodeShapeProvider: IDataProvider, subtreeShapeProvider: IDataProvider, graph: LayoutGraph, localRoot: YNode, parentConnectorDirection: ParentConnectorDirection) : SubtreeShapeInitializes the local data structures and then delegates the work to the abstract variant of this method (placeSubtreeOfNode)
Parameters
A map of options to pass to the method.
- nodeShapeProvider - IDataProvider
- the IDataProvider for obtaining an initial shape of the root node
Domain YNode Values SubtreeShape the shape of the node - subtreeShapeProvider - IDataProvider
- the IDataProvider for accessing the pre-calculated shapes of the subtrees
Domain YNode Values SubtreeShape the shape of the subtree rooted at the node - graph - LayoutGraph
- the input graph
- localRoot - YNode
- the root of the subtree that should be arranged by this method
- parentConnectorDirection - ParentConnectorDirection
- the direction specifier for the connector of the local root node to its parent node
Returns
- ↪SubtreeShape
- the merged SubtreeShape for the subtree rooted at the local root node
See Also
Implements
placeSubtreeOfNode
(localRoot: YNode, parentConnectorDirection: ParentConnectorDirection) : SubtreeShapeArranges the SubtreeShapes of children of the local root node in rows or columns that fit the specified aspect ratio.
Parameters
A map of options to pass to the method.
- localRoot - YNode
- the local root node
- parentConnectorDirection - ParentConnectorDirection
- the direction of the connector
Returns
- ↪SubtreeShape
- the SubtreeShape containing the local root and all its subtrees
Implements
Fields
The graph instance this class is working on.