Specifies custom data for the OrthogonalLayout.
Examples
The following example shows how to create a new instance of OrthogonalLayoutData and use it with an OrthogonalLayout:
In many cases the complete initialization of OrthogonalLayoutData can also be done in a single object initializer:
Type Details
- yfiles module
- view-layout-bridge
- yfiles-umd modules
- view-layout-bridge
- Legacy UMD name
- yfiles.orthogonal.OrthogonalLayoutData
See Also
Constructors
Creates a new instance of OrthogonalLayoutData which helps configuring OrthogonalLayout.
Parameters
A map of options to pass to the method.
- edgeLayoutDescriptors - ItemMapping<IEdge,OrthogonalLayoutEdgeLayoutDescriptor>
The mapping from edges to their OrthogonalLayoutEdgeLayoutDescriptor. This option sets the edgeLayoutDescriptors property on the created object.
- directedEdges - ItemCollection<IEdge>
The collection of edges that should be routed in a way that point in the main layout direction. This option sets the directedEdges property on the created object.
- edgeDirectedness - ItemMapping<IEdge,number>
The mapping from edges to their directedness, which is considered for the detection of substructures. This option sets the edgeDirectedness property on the created object.
- edgeCrossingCosts - ItemMapping<IEdge,number>
The mapping from edges to their crossing cost. This option sets the edgeCrossingCosts property on the created object.
- edgeBendCosts - ItemMapping<IEdge,number>
The mapping from edges to their bend cost. This option sets the edgeBendCosts property on the created object.
- sourceGroupIds - ItemMapping<IEdge,Object>
A mapping from edges to an object representing their source edge group. This option sets the sourceGroupIds property on the created object.
- targetGroupIds - ItemMapping<IEdge,Object>
A mapping from edges to an object representing their target edge group. This option sets the targetGroupIds property on the created object.
- nodeTypes - ItemMapping<INode,Object>
The mapping from nodes to an object defining the node type, which is considered for the detection of tree, chain and cycle substructures. This option sets the nodeTypes property on the created object.
- nodeHalos - ItemMapping<INode,NodeHalo>
- abortHandler - AbortHandler
The AbortHandler used during the layout. This option sets the abortHandler property on the created object.
- edgeLabelPreferredPlacement - ItemMapping<ILabel,PreferredPlacementDescriptor>
The mapping that provides a PreferredPlacementDescriptor instance for edge ILabels. This option sets the edgeLabelPreferredPlacement property on the created object.
Properties
Gets or sets the AbortHandler used during the layout.
Remarks
An AbortHandler can be used to gracefully stop or cancel a running layout and offers options for automatically doing so after a predetermined time.
An AbortHandler configured or set here overrides the one on LayoutExecutor.
Examples
The most common use case would be to just configure the AbortHandler here, e.g. to set timeouts for a graceful stop or canceling the running layout:
layoutData.abortHandler.stopDuration = TimeSpan.fromSeconds(10) layoutData.abortHandler.cancelDuration = TimeSpan.fromSeconds(30)
layoutData.abortHandler!.stopDuration = TimeSpan.fromSeconds(10) layoutData.abortHandler!.cancelDuration = TimeSpan.fromSeconds(30)
If there's already an AbortHandler instance that's pre-configured or will be used in a different place to, e.g., cancel the layout when the user presses a button, you can also set one explicitly:
layoutData.abortHandler = abortHandler
See Also
Gets or sets the collection of edges that should be routed in a way that point in the main layout direction.
Remarks
Examples
If only a few edges should be routed in layout direction, the easiest way is often to add them one by one via the items collection:
layoutData.directedEdges.items.add(edge1)
layoutData.directedEdges.items.add(edge2)
If you already have a collection or IEnumerable<T> for those edges, the source property is usually easier:
// Consider outgoing edges at selected nodes
layoutData.directedEdges = graphComponent.selection.selectedNodes.flatMap(
(node) => graphComponent.graph.outEdgesAt(node)
)
If it can be inferred directly from the edge itself whether it should be routed that way, a delegate is often most convenient:
layoutData.directedEdges = (edge) => edge.tag.routeInLayoutDirection
layoutData.directedEdges = (edge: IEdge): boolean =>
edge.tag.routeInLayoutDirection
See Also
Gets or sets the mapping from edges to their bend cost.
Remarks
1
, which is used for edges which do not have an individual bend cost.Examples
See Also
Gets or sets the mapping from edges to their crossing cost.
Remarks
1
, which is used for edges which do not have an individual crossing cost.Examples
See Also
Gets or sets the mapping from edges to their directedness, which is considered for the detection of substructures.
Remarks
The directedness is only considered for the detection of substructures in the input graph i.e., trees, chains and cycles. A substructure is only identified as such if all edges are either undirected or consistently directed with respect to the specified directedness.
- A directedness value of
1
indicates that the edge is considered to be directed from source to target. - A directedness value of
-1
indicates that the edge is considered to be directed from target to source. - A directedness value of
0
indicates that the edge is considered to be undirected.
All edges are undirected per default.
Examples
The easiest option is to define all edges with the same directedness:
Handling only certain edges differently can be done easily by using the mapper property:
In cases where the directedness for each edge can be determined by looking at the edge itself it's often easier to just set a delegate instead of preparing a mapper:
See Also
Gets or sets the mapping that provides a PreferredPlacementDescriptor instance for edge ILabels.
Examples
Depending on how much customization is needed, some ways of setting PreferredPlacementDescriptors are more convenient than others. For example, to set the same descriptor for all labels, you can just use the constant property:
If some labels should use custom placement or this has to be configured ahead of time, you can use the mapper instead:
When the preferred placement can be inferred from the label itself, a delegate is usually the easiest choice:
Note that the preferred placement can also be inferred from an arbitrary ILabelModelParameter:
See Also
Gets or sets the mapping from edges to their OrthogonalLayoutEdgeLayoutDescriptor.
Remarks
null
, a default edge layout descriptor will be obtained using method createEdgeLayoutDescriptor.See Also
Gets or sets the mapping from nodes to their NodeHalo.
Remarks
Examples
The easiest option is to reserve the same space around all nodes, by setting a constant NodeHalo:
Handling only certain nodes differently can be done easily by using the mapper property:
In cases where the NodeHalo for each node can be determined by looking at the node itself it's often easier to just set a delegate instead of preparing a mapper:
See Also
Gets or sets the mapping from nodes to an object defining the node type, which is considered for the detection of tree, chain and cycle substructures.
Remarks
See Also
Gets or sets a mapping from edges to an object representing their source edge group.
Remarks
Examples
One simple way to use source groups is to use the edge's source node as group ID which effectively groups all edges with the same source together:
Another useful way to use a delegate here would be grouping edges by some commonality, such as the same color:
If only certain edges should be grouped it may sometimes be easier to use the mapper to set the group IDs:
See Also
Gets or sets a mapping from edges to an object representing their target edge group.
Remarks
Examples
One simple way to use source groups is to use the edge's target node as group ID which effectively groups all edges with the same target together:
Another useful way to use a delegate here would be grouping edges by some commonality, such as the same color:
If only certain edges should be grouped it may sometimes be easier to use the mapper to set the group IDs:
See Also
Methods
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.