A LayeredNodePlacer arranges the nodes of a subtree respecting layers.
Remarks
Layout Style
Nodes that have the same depth in the tree will be placed in the same horizontal layer. They will be vertically aligned.
Default Values of Properties
busAlignment | 0.5 | |
dendrogramStyle | false | The nodes are assigned to the topmost layer. |
layerSpacing | 40 | |
rootAlignment | CENTER_OVER_CHILDREN
| |
routingStyle | STRAIGHT
| |
spacing | 20 | |
verticalAlignment | 0.5 | Nodes are center aligned. |
Type Details
- yfiles module
- layout-tree
- yfiles-umd modules
- layout-orthogonal-compact, layout-orthogonal, layout-tree, layout
- Legacy UMD name
- yfiles.tree.LayeredNodePlacer
See Also
Constructors
Creates a new LayeredNodePlacer instance whose direction is specified by the given modification matrix.
Remarks
Parameters
A map of options to pass to the method.
- modificationMatrix - RotatableNodePlacerMatrix
- the transformation matrix for this RotatableNodePlacerBase DEFAULT if none is provided.
- id - Object
- the LayeredNodePlacer ID
- dendrogramStyle - boolean
Whether or not the layering is done dendrogram-like. This option sets the dendrogramStyle property on the created object.
- rootAlignment - RootNodeAlignment
The RootAlginment that defines how the root node is aligned with its children and their shapes. This option sets the rootAlignment property on the created object.
- verticalAlignment - number
The relative vertical alignment of nodes within their respective layers. This option sets the verticalAlignment property on the created object.
- layerSpacing - number
The distance between two adjacent layers. This option sets the layerSpacing property on the created object.
- routingStyle - LayeredRoutingStyle
The routing style for the edges in the subtree. This option sets the routingStyle property on the created object.
- busAlignment - number
The vertical bus alignment for orthogonally routed edges. This option sets the busAlignment property on the created object.
- polylineLabeling - boolean
Whether or not straight edges are extended to avoid label overlaps. This option sets the polylineLabeling property on the created object.
- spacing - number
The spacing between subtrees. This option sets the spacing property on the created object.
- alignPorts - boolean
Whether or not nodes are placed so that the source and target port of an edge are aligned. This option sets the alignPorts property on the created object.
Properties
Gets or sets whether or not nodes are placed so that the source and target port of an edge are aligned.
Remarks
Dependent on the RootNodeAlignment the subtree root is moved in a way that the edge connecting the root to one of its children is straightened.
This setting only applies to the following RootNodeAlignments:
Default Value
false
.Ports are not aligned.
Sample Graphs
Defined in
Gets or sets the vertical bus alignment for orthogonally routed edges.
Remarks
The bus alignment determines the relative position of an edge bus in between two subsequent layers of nodes.
Values for a valid vertical alignment are in the range [0..1]
, such that:
- A value of
0.0
places the bus at the top, right below the parent node. - A value of
0.5
places the bus in the middle between parent and child nodes. - A value of
1.0
places the bus at the bottom, right above the child nodes.
Default Value
0.5
.Throws
- Exception({ name: 'ArgumentError' })
- if the specified alignment is outside
[0..1]
See Also
Sample Graphs
Gets or sets whether or not the layering is done dendrogram-like.
Remarks
Default Value
false
.The nodes are assigned to the topmost layer.
Sample Graphs
Gets the ID of this LayeredNodePlacer.
Remarks
Gets or sets the distance between two adjacent layers.
Remarks
Default Value
40
.Throws
- Exception({ name: 'ArgumentError' })
- if the specified spacing is negative
See Also
Sample Graphs
Gets the modification matrix that defines the direction of the subtree.
Gets or sets whether or not straight edges are extended to avoid label overlaps.
Remarks
Default Value
false
.Edges are only routed straight.
Sample Graphs
Gets or sets the RootAlginment that defines how the root node is aligned with its children and their shapes.
Default Value
CENTER_OVER_CHILDREN.Throws
- Exception({ name: 'ArgumentError' })
- if the given root alignment is
null
Gets or sets the spacing between subtrees.
Remarks
Default Value
20
.Throws
- Exception({ name: 'ArgumentError' })
- if the given spacing is negative
Sample Graphs
Defined in
Gets or sets the relative vertical alignment of nodes within their respective layers.
Remarks
A value of 0
means that nodes are top-aligned; a value of 0.5
means that nodes are center-aligned; a value of 1
means that nodes are bottom-aligned;
Values for a valid vertical alignment are in the range [0..1]
.
Default Value
0.5
.Nodes are center aligned.
Throws
- Exception({ name: 'ArgumentError' })
- if the specified alignment is outside
[0..1]
Sample Graphs
Methods
Creates a IComparer<T> for outgoing edges that takes the rotation into account.
Delegates to createComparer.
Creates a IProcessor that distributes the nodes over the layers.
Remarks
Parameters
A map of options to pass to the method.
- layouter - TreeLayout
- the current TreeLayout instance
- graph - LayoutGraph
- the input graph
- currentRoot - YNode
- the current root node for this node placer
Returns
- ↪IProcessor
- the IProcessor or
null
if the layer information is already assigned to the current root
See Also
Overrides
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
- 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
See Also
Implements
Returns the rotated subtree shape for the given node.
Remarks
Parameters
A map of options to pass to the method.
- node - YNode
- the node
Returns
- ↪RotatedSubtreeShape
- the subtree shape for the given node
Defined in
Returns the target PortConstraint for the local root's incoming edge.
Remarks
This method translates the PortConstraint according to the rotation described by the modification matrix. It should be used instead of getTPC.
This method may be used in placeSubtreeOfNode to route the edges to the according port. It may be overridden to provide constant PortConstraints for each node.
Parameters
A map of options to pass to the method.
- localRoot - YNode
- the local root
Returns
- ↪PortConstraint
- the PortConstraint for the incoming edge of the local root or ANY if no PortConstraint is assigned for that edge
Defined in
Returns the absolute source point of the given edge depending on the rotation of this ITreeLayoutNodePlacer.
Remarks
This method translates the source point according to the rotation described by the modification matrix. It should be used instead of getSourcePointAbs.
It can be used in an implementation of placeSubtreeOfNode.
Parameters
A map of options to pass to the method.
- edge - Edge
- the edge whose absolute source point should be calculated
Returns
- ↪YPoint
- the translated absolute source point for the given edge and current modification matrix
Defined in
Returns the rotated subtree shape for the subtree rooted at the given node.
Remarks
Parameters
A map of options to pass to the method.
- node - YNode
- the local root node
Returns
- ↪RotatedSubtreeShape
- the rotated subtree shape 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) : RotatedSubtreeShapePlaces the children of local root in layers.
Parameters
A map of options to pass to the method.
- localRoot - YNode
- the local root node
- parentConnectorDirection - ParentConnectorDirection
- the direction specifier for the connector of the local root node to its parent node
Returns
- ↪RotatedSubtreeShape
- the merged subtree shape that contains the local root node and all its children
Implements
Translates the given real direction of the resulting layout to the model direction of this RotatableNodePlacerBase.
Remarks
Parameters
A map of options to pass to the method.
- realDirection - ParentConnectorDirection
- the real direction
Returns
- ↪number
- the model direction
Throws
- Exception({ name: 'ArgumentError' })
- if translation for the given real direction is not implemented
Defined in
Translates the given model direction to the real direction in the resulting layout.
Remarks
Parameters
A map of options to pass to the method.
- modelDirection - ParentConnectorDirection
- the model direction
Returns
- ↪number
- the real direction
Throws
- Exception({ name: 'ArgumentError' })
- if translation for the given model direction is not implemented
Defined in
Fields
The list containing the created children.
Defined in
The graph instance this ITreeLayoutNodePlacer is working on.
Defined in
The provider of SubtreeShapes for single nodes.
Defined in
The provider of SubtreeShapes for whole subtrees.