The CompactSubtreePlacer produces a compact placement of the children.
Remarks
Layout Style
This ISubtreePlacer uses a dynamic optimization approach that chooses a placement strategy of the children of the associated local root such that the overall result is compact with respect to a specified aspect ratio. The set of applied strategies is predefined and cannot be customized. A node can either be a normal tree node or an assistant node, in which case the AssistantSubtreePlacer is chosen automatically (i.e., you shouldn't explicitly map nodes to instances of AssistantSubtreePlacer but mark them with assistantNodes).
Default Values of Properties
horizontalDistance | 20 | |
preferredAspectRatio | 1 | |
verticalDistance | 20 |
Type Details
- yFiles module
- algorithms
See Also
Constructors
Creates a new CompactSubtreePlacer instance with default settings.
Parameters
A map of options to pass to the method.
- 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.
- preferredAspectRatio - number
- The preferred aspect ratio (width/height) for the subtrees. This option sets the preferredAspectRatio property on the created object.
- minimumFirstSegmentLength - number
- The minimum length for the first segment of an edge. This option sets the minimumFirstSegmentLength property on the created object.
- minimumLastSegmentLength - number
- The minimum length for the last segment of an edge. This option sets the minimumLastSegmentLength property on the created object.
Properties
Gets or sets the horizontal distance between nodes or subtrees.
Remarks
Default Value
20
.Property Value
Throws
- Exception({ name: 'ArgumentError' })
- if the specified distance is negative
Sample Graphs
Gets or sets the minimum length for the first segment of an edge.
Remarks
During layout calculation, the edges of the tree are directed. Hence, the first segment is always the segment that is attached to the source, which is the local root node.
The length needs to be non-negative.
Default Value
20
.Property Value
Throws
- Exception({ name: 'ArgumentError' })
- if the minimum segment length is negative
See Also
Sample Graphs
Gets or sets the minimum length for the last segment of an edge.
Remarks
During layout calculation, the edges of the tree are directed. Hence, the last segment is always the segment that is attached to the target, which is a child node.
The length needs to be non-negative.
Default Value
20
.Property Value
Throws
- Exception({ name: 'ArgumentError' })
- if the minimum segment length is negative
Sample Graphs
Gets or sets the preferred aspect ratio (width/height) for the subtrees.
Remarks
Default Value
1
.Property Value
Throws
- Exception({ name: 'ArgumentError' })
- if the specified aspect ratio is negative
0
, the algorithm automatically chooses one that leads to a small overall area.Gets or sets the vertical distance between nodes or subtrees.
Remarks
Default Value
20
.Property Value
Throws
- Exception({ name: 'ArgumentError' })
- if the specified distance is negative
See Also
Sample Graphs
Methods
Returns a clone of this ISubtreePlacer instance.
Returns
- ↪any
- an exact copy of this ISubtreePlacer instance
createProcessor
(treeLayout: TreeLayout, graph: LayoutGraph, currentRoot: LayoutNode) : ISubtreePlacerProcessorCreates a ISubtreePlacerProcessor.
Parameters
A map of options to pass to the method.
- treeLayout - TreeLayout
- The current TreeLayout instance
- graph - LayoutGraph
- The input graph
- currentRoot - LayoutNode
- The root node handled by this ISubtreePlacer
Returns
- ↪ISubtreePlacerProcessor?
- An ISubtreePlacerProcessor instance or
null
Implements
determineChildConnectors
(localRoot: LayoutNode, connectorMap: IMapper<LayoutNode,ParentConnectorDirection>)Provides the direction of the connector to the SubtreeShape for each child node.
Parameters
A map of options to pass to the method.
- localRoot - LayoutNode
- The local root node
- connectorMap - IMapper<LayoutNode,ParentConnectorDirection>
- The IMapper<K,V> that is used for storing the direction specifiers of the child nodes
Implements
placeSubtree
(nodeShapeProvider: IMapper<LayoutNode,SubtreeShape>, subtreeShapeProvider: IMapper<LayoutNode,SubtreeShape>, graph: LayoutGraph, localRoot: LayoutNode, parentConnectorDirection: ParentConnectorDirection) : SubtreeShapeInitializes the local data structures and then arranges the local root relative to the SubtreeShape of its children.
Parameters
A map of options to pass to the method.
- nodeShapeProvider - IMapper<LayoutNode,SubtreeShape>
- the IMapper<K,V> for obtaining an initial shape of the root node
- subtreeShapeProvider - IMapper<LayoutNode,SubtreeShape>
- the IMapper<K,V> for accessing the pre-calculated shapes of the subtrees
- graph - LayoutGraph
- the input graph
- localRoot - LayoutNode
- 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
Implements
Constants
A data key for storing/restoring the placement strategy of the children of nodes.