The LeftRightNodePlacer arranges the children in a subtree on the left and the right of a vertical bus.
Remarks
Layout Style
The default settings generate a layout with a single vertical bus, where children are placed left and right of it. By adjusting the branch count, it is possible to generate multiple vertical buses (i.e. branches) that are placed next to each other, below the root node.Default Values of Properties
branchCount | 1 | The layout consists of a single branch. |
horizontalDistance | 20 | |
placeLastOnBottom | true | The last child is centered below its siblings |
verticalDistance | 20 |
Type Details
- yfiles module
- layout-tree
- yfiles-umd modules
- layout-orthogonal-compact, layout-orthogonal, layout-tree, layout
- Legacy UMD name
- yfiles.tree.LeftRightNodePlacer
See Also
Constructors
Creates a new LeftRightNodePlacer instance using the given modification matrix.
Parameters
A map of options to pass to the method.
- modificationMatrix - RotatableNodePlacerMatrix
- the transformation matrix for this RotatableNodePlacerBase. DEFAULT if none is provided.
- horizontalDistance - number
The horizontal distance between nodes or subtrees. This option sets the horizontalDistance property on the created object.
- verticalDistance - number
The vertical distance between nodes or subtrees. This option sets the verticalDistance property on the created object.
- spacing - number
A uniform horizontal and vertical spacing between subtrees. This option sets the spacing property on the created object.
- branchCount - number
The number of branches (buses) of the subtree layout. This option sets the branchCount property on the created object.
- placeLastOnBottom - boolean
Whether or not the last child is placed centered, aligned with the bus and below the other child nodes. This option sets the placeLastOnBottom 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 number of branches (buses) of the subtree layout.
Remarks
Default Value
1
.The layout consists of a single branch.
Throws
- Exception({ name: 'ArgumentError' })
- if the given branch count is smaller than
1
Sample Graphs
Gets or sets the horizontal distance between nodes or subtrees.
Remarks
Default Value
20
.Throws
- Exception({ name: 'ArgumentError' })
- if the specified distance is negative
Sample Graphs
Gets the modification matrix that defines the direction of the subtree.
Gets or sets whether or not the last child is placed centered, aligned with the bus and below the other child nodes.
Remarks
Default Value
true
.The last child is centered below its siblings
Sample Graphs
Sets a uniform horizontal and vertical spacing between subtrees.
Remarks
Throws
- Exception({ name: 'ArgumentError' })
- if the specified spacing value is negative
See Also
Overrides
Gets or sets the vertical distance between nodes or subtrees.
Remarks
Default Value
20
.Throws
- Exception({ name: 'ArgumentError' })
- if the specified distance is negative
Sample Graphs
Methods
Returns a IComparer<T> for outgoing edges that considers the locations of the target nodes.
Remarks
Returns
- ↪IComparer<any>
- the IComparer<T> that compares outgoing edges according to the locations of their target nodes
Overrides
Delegates to createComparer.
Creates a processor that distributes the child elements into multiple branches, if necessary.
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 root node handled by this ITreeLayoutNodePlacer
Returns
- ↪IProcessor
- the processor distributing children to multiple branches or
null
if only a single-branch layout is created
Overrides
Determines a connector direction for the given child node.
Remarks
Parameters
A map of options to pass to the method.
- child - YNode
- the child node
Returns
- ↪ParentConnectorDirection
- a direction specifier as defined in the ITreeLayoutNodePlacer interface
Throws
- Exception({ name: 'InvalidOperationError' })
- if this method is called
Implements
Determines the direction of the child connectors according to which side of the bus the child is assigned.
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
See Also
Overrides
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 subtree shapes of the children left and right of a common vertical bus.
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.
Defined in
Constants
A data provider key for assigning nodes to the left or the right side of the bus.
Remarks
Domain | YNode | |
Values | boolean | true if the node should be placed left of the bus, false if it should be placed right of the bus |
See Also
Static Methods
Creates a special IDataProvider that determines whether a given node is placed left or right of the parent node.
Remarks
This IDataProvider can be registered with the graph with key LEFT_RIGHT_DP_KEY. It calculates the side with respect to the initial coordinates of the nodes in the graph, considering the orientation of the subtree.
If a node is assigned to the left side, this IDataProvider will return true
. For the right side, it will return false
.
Parameters
A map of options to pass to the method.
- nodePlacerMap - IDataProvider
- a IDataProvider containing the corresponding ITreeLayoutNodePlacers for the node