Specifies sequence constraints for nodes and edges for a HierarchicLayout.
Remarks
Sequence constraints affect the sequence of nodes within a layer.
If itemComparables are specified, they are used to sort all nodes and edges accordingly and create placeAfter constraints that are handles just like manually added constraints.
Examples
One way to set sequence constraints is by mapping nodes or edges to an IComparable (e.g. a number) which define the order in which those nodes are placed within the same layer. This can be done with the itemComparables property. One way to map each item to such 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 SequenceConstraintData:
Type Details
- yfiles module
- view-layout-bridge
- yfiles-umd modules
- view-layout-bridge
- Legacy UMD name
- yfiles.hierarchic.SequenceConstraintData
See Also
- Sequence constraints cannot be used together with swimlanes.
- Sequence constraints that are specified for a group child node will be applied to the parent node instead.
Sample Graphs
Constructors
Creates a new instance of SequenceConstraintData which helps configuring sequence constraints for HierarchicLayout.
Parameters
A map of options to pass to the method.
- itemComparables - ItemMapping<IModelItem,IComparable>
The mapping from nodes or edges to an IComparable (for example a number or string) defining their sequence sort order. This option sets the itemComparables property on the created object.
Properties
Gets or set the mapping from nodes or edges to an IComparable (for example a number or string) defining their sequence sort order.
Remarks
null
, no constraints are added.Examples
Sample Graphs
Methods
Clears all previously defined constraints.
Remarks
All constraints that were previously defined via placeBefore, placeAfter, placeAtHead or placeAtTail were cleared so that new constraints can be declared.
This doesn't affect indirect constraints specified by the itemComparables.
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 afterItem
of type INode or IEdge to lie after the item
of type INode or IEdge.
Parameters
A map of options to pass to the method.
- item - IModelItem
- the reference node or edge
- afterItem - IModelItem
- the node or edge that should be placed after the reference element
Examples
See Also
Sample Graphs
after
edge should be placed after that of the reference
edge, if possible). Constraints of edges with recursive edge style are ignored.Adds a constraint that places a INode or IEdge at the start of the sequence.
Parameters
A map of options to pass to the method.
- item - IModelItem
- the node or edge that should be placed at the start
Examples
See Also
Sample Graphs
Adds a constraint that places a INode or IEdge at the end of the sequence.
Parameters
A map of options to pass to the method.
- item - IModelItem
- the node or edge that should be placed at the end
Examples
See Also
Sample Graphs
Adds a constraint that forces the beforeItem
of type INode or IEdge to lie before the item
of type INode or IEdge.
Parameters
A map of options to pass to the method.
- item - IModelItem
- the reference node or edge
- beforeItem - IModelItem
- the node or edge that should be placed before the reference element
Examples
See Also
Sample Graphs
before
edge should be placed before that of the reference
edge, if possible). Constraints of edges with recursive edge style are ignored.