Specifies layer constraints for nodes for a HierarchicLayout.
Remarks
Layer constraints affect the assignment of nodes to layers. A layer constraint can be specified either explicitly for a given node or by mapping some or all nodes to an IComparable, e.g., a number, with the nodeComparables property.
In the latter case, the comparables are used to create placeBelow constraints between one node and another if the one precedes the other. These constrains work just like explicitly created constraints. Note that equal values do not result in placeInSameLayer constraints, and no constraints are added for nodes mapped to null
..
Examples
One way to map each node to an IComparable is to use the delegate:
If only some nodes should be constrained, the mapper can be used instead:
If those mappings have been prepared beforehand, e.g. in a HashMap<TKey,TValue> or IMapper<K,V>, that property on the ItemMapping<TItem,TValue> can also be set:
IComparable is only the most natural option if such an object can be readily produced from a node, or there already exists such a mapping from nodes to something that can be compared. In many cases it can be easier to construct constraints manually with the respective methods on LayerConstraintData:
Type Details
- yfiles module
- view-layout-bridge
- yfiles-umd modules
- view-layout-bridge
- Legacy UMD name
- yfiles.hierarchic.LayerConstraintData
See Also
Sample Graphs
Constructors
Creates a new instance of LayerConstraintData which helps configuring ILayerConstraints for HierarchicLayout.
Parameters
A map of options to pass to the method.
- nodeComparables - ItemMapping<INode,IComparable>
The mapping from nodes to an IComparable (for example a number or string) defining their layer constraints. This option sets the nodeComparables property on the created object.
Properties
Gets or set the mapping from nodes to an IComparable (for example a number or string) defining their layer constraints.
Remarks
null
.Examples
See Also
Sample Graphs
Methods
Clears all previously defined constraints.
Remarks
All constraints that were previously defined via placeAbove, placeBelow, placeInSameLayer, placeAtTop or placeAtBottom were cleared so that new constraints can be declared.
This doesn't affect indirect constraints specified by the nodeComparables.
Examples
Combines this instance with the given layout data.
Remarks
Parameters
A map of options to pass to the method.
- data - LayoutData
- The LayoutData to combine this instance with.
Returns
- ↪LayoutData
- The combined layout data.
See Also
Defined in
Adds a constraint that forces the aboveNode
to lie at least minDistance
layers above the referenceNode
with a given weight
penalty for larger layer differences.
Remarks
Parameters
A map of options to pass to the method.
- referenceNode - INode
- the reference node
- aboveNode - INode
- the node that should lie above
- minDistance - number
- the minimum layer distance between the node and its reference node
- weight - number
- the weight penalty for larger layer differences
Examples
See Also
Sample Graphs
Adds a constraint that places the node
on the bottom layer.
Parameters
A map of options to pass to the method.
- node - INode
- the node that should lie on the bottom layer
Examples
See Also
Sample Graphs
Adds a constraint that places the node
on the topmost layer.
Parameters
A map of options to pass to the method.
- node - INode
- the node that should lie on the top layer
Examples
See Also
Sample Graphs
Adds a constraint that forces the belowNode
to lie at least minDistance
layers below the referenceNode
with a given weight
penalty for larger layer differences.
Remarks
Parameters
A map of options to pass to the method.
- referenceNode - INode
- the reference node
- belowNode - INode
- the node that should lie below
- minDistance - number
- the minimum layer distance between the node and its reference node
- weight - number
- the weight penalty for larger layer differences