Specifies custom data for the OrganicLayout.
Examples
The following example shows how to create a new instance of OrganicLayoutData and use it with an OrganicLayout:
In many cases the complete initialization of OrganicLayoutData 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.organic.OrganicLayoutData
See Also
Constructors
Creates a new instance of OrganicLayoutData which helps configuring OrganicLayout.
Parameters
A map of options to pass to the method.
- affectedNodes - ItemCollection<INode>
The subset of nodes that is moved by the layout algorithm. This option sets the affectedNodes property on the created object.
- preferredEdgeLengths - ItemMapping<IEdge,number>
A mapping from edges to their preferred lengths. This option sets the preferredEdgeLengths property on the created object.
- minimumEdgeLengths - ItemMapping<IEdge,number>
A mapping from edges to their minimum lengths. This option sets the minimumEdgeLengths property on the created object.
- constraints - OrganicConstraintData
The OrganicConstraintData that allows to define additional constraints on the nodes of a graph that will be applied by the OrganicLayout during the layout calculation. This option sets the constraints property on the created object.
- edgeOrientations - ItemMapping<IEdge,number>
A mapping from edges to their orientation in the layout. This option sets the edgeOrientations property on the created object.
- minimumNodeDistances - ItemMapping<INode,number>
A mapping from nodes to their minimum distances to other nodes around them. This option sets the minimumNodeDistances property on the created object.
- overlappingNodes - ItemCollection<INode>
The collection of nodes that are allowed to overlap with other nodes. This option sets the overlappingNodes property on the created object.
- groupNodeModes - ItemMapping<INode,GroupNodeMode>
The mapping from group nodes to a mode constant describing how to handle the group node. This option sets the groupNodeModes property on the created object.
- nodeHalos - ItemMapping<INode,NodeHalo>
- nodeTypes - ItemMapping<INode,Object>
The mapping from nodes to an object defining the node type, which is considered for the detection of star, parallel, chain and cycle substructures. This option sets the nodeTypes property on the created object.
- abortHandler - AbortHandler
The AbortHandler used during the layout. This option sets the abortHandler property on the created object.
- partitionGridData - PartitionGridData
The partition grid layout data. This option sets the partitionGridData property on the created object.
- edgeDirectedness - ItemMapping<IEdge,number>
The mapping from edges to their directedness. This option sets the edgeDirectedness 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.
- nodeInertia - ItemMapping<INode,number>
The mapping from non-group nodes to their inertia. This option sets the nodeInertia property on the created object.
- nodeStress - ItemMapping<INode,number>
The mapping from non-group nodes to their stress value. This option sets the nodeStress property on the created object.
- clusterIds - ItemMapping<INode,Object>
The mapping from nodes to user-defined cluster IDs. This option sets the clusterIds property on the created object.
- zCoordinates - IMapper<INode,number>
A mapper from non-group nodes to the computed center z-coordinate in case that a 3D layout was created. This option sets the zCoordinates 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 subset of nodes that is moved by the layout algorithm.
Remarks
Examples
Defining the subset of nodes that should be laid out can be done in various ways, mostly depending on which option is more convenient for a particular use case. You can use the ItemCollection<TItem>'s source property to use any .NET collection or IEnumerable<T>:
Alternatively, ItemCollection<TItem> also has an items property, which is a collection that already exists, in case the items may have to be added one by one. This can be more convenient than defining an own list and setting it to source:
A powerful option that doesn't use a collection is to use the delegate to set a custom delegate that returns for every node whether it is contained in the set or not:
See Also
Gets or sets the mapping from nodes to user-defined cluster IDs.
Remarks
The clusteringPolicy must be set to USER_DEFINED for the custom clusters to be considered.
Nodes with equal cluster ID form a cluster, hence, will be placed closer together. The value null
indicates that a node is not part of any cluster.
Examples
A convenient way to define clusters is to set a delegate that returns the cluster identifier for each node, for example, using the tag of the nodes:
If the clusters are already given as a collection of the respective nodes, using the mapper is practical:
See Also
Gets or sets the OrganicConstraintData that allows to define additional constraints on the nodes of a graph that will be applied by the OrganicLayout during the layout calculation.
See Also
Gets or sets the mapping from edges to their directedness.
Remarks
This property allows the user to specify hints on the directedness of edges. More precisely, a value of 1
indicates that the edge should be considered to be directed from source to target, a value of -1
that it is directed from target to source, and a value of 0
means that it is undirected.
The specified values are considered during the detection of special substructures, see chainSubstructureStyle, cycleSubstructureStyle, parallelSubstructureStyle and starSubstructureStyle.
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 a mapping from edges to their orientation in the layout.
Remarks
More precisely, a positive value indicates that the edge orientation should correspond to the main layout direction, a negative value indicates that the edge should have the opposite orientation, and a value of zero means that the orientation can be chosen arbitrarily by the layout algorithm.
If the edge orientation for an edge is not explicitly mapped in the mapper, it is assumed that it can have an arbitrary orientation. Hence, the specified main layout direction does not matter at all.
Examples
Specifying the edge orientation for specific edges can be accomplished easily by using the mapper property:
In cases where the edge orientation can be determined by looking at the edge itself it's often easier to just set a delegate instead of preparing a mapper:
Finally, there's also the option to use the same value for all edges:
See Also
Gets or sets the mapping from group nodes to a mode constant describing how to handle the group node.
Remarks
Examples
The easiest option is to treat all group nodes the same, by just setting a constant value:
Handling only certain group nodes differently can be done easily by using the mapper property:
In cases where the ideal GroupNodeMode 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 a mapping from edges to their minimum lengths.
Remarks
Examples
Specifying a minimum length for specific edges can be accomplished easily by using the mapper property:
In cases where the minimum length can be determined by looking at the edge itself it's often easier to just set a delegate instead of preparing a mapper:
Finally, there's also the option to use the same value for all edges:
See Also
Gets or sets a mapping from nodes to their minimum distances to other nodes around them.
Remarks
This setting only has an effect when nodeOverlapsAllowed is false
and only applies to the post-processing step that moves overlapping nodes. So the distances from a node that never had overlaps to begin with, may not follow this setting.
Minimum distance values must be greater than 0
.
Examples
Specifying a minimum node distance for specific nodes, overriding the default setting on OrganicLayout can be accomplished easily by using the mapper property:
In cases where the minimum distance can be determined by looking at the node itself it's often easier to just set a delegate instead of preparing a mapper:
Finally, there's also the somewhat nonsensical option to use the same value for all edges, which, as the comment notes, can be achieved easier by just setting the respective property on OrganicLayout:
See Also
Sample Graphs
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 non-group nodes to their inertia.
Remarks
[0,1]
. For nodes of sub-structures the inertia value is not considered. The default inertia value is 0.0
and applied if no inertia values are defined or if a node has no individual value.- 1.0 – The node will not move.
- 0.5 – The node will only move half as far as it would with an inertia of
0.0
. - 0.0 – The node will move as fast as possible.
Examples
The easiest option is to define the same inertia for all nodes:
Handling only certain nodes differently can be done easily by using the mapper property:
In cases where the inertia 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
0.0
, the algorithm considers the initial coordinates of the nodes (similar as for SUBSET).Gets or sets the mapping from non-group nodes to their stress value.
Remarks
The stress value indicates how far a node will possibly move. The higher the stress of a node is, the farther it may move.
The stress can be specified if the scope is set to ALL. It is defined to be a value from the interval [0,1]
. For nodes of sub-structures the stress value is not considered. The default stress value is 1.0
and applied if no stress values are defined or if a node has no individual value.
Examples
The easiest option is to define the same stress for all nodes:
Handling only certain nodes differently can be done easily by using the mapper property:
In cases where the inertia 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
1.0
, the algorithm considers the initial coordinates of the nodes (similar as for SUBSET).Gets or sets the mapping from nodes to an object defining the node type, which is considered for the detection of star, parallel, chain and cycle substructures.
Remarks
If node types are defined, only nodes of the same type or nodes which all have no type can form a substructure.
For parallel substructures, property parallelSubstructureTypeSeparation controls whether parallel substructures are strictly separated by type or if a structure may contain nodes of different types but the substructure layout itself takes care that different types are visually separated (e.g. by placing nodes of the same type closer together or on the same circle).
The same does property starSubstructureTypeSeparation for star substructures.
See Also
Sample Graphs
Gets or sets the collection of nodes that are allowed to overlap with other nodes.
Remarks
Examples
Specifying the property for specific nodes, overriding the default setting on OrganicLayout can be accomplished easily by using the items property:
In cases where the property can be determined by looking at the node itself, it's often easier to just set a delegate instead of adding it to the items:
See Also
false
.Gets or sets the partition grid layout data.
Remarks
Examples
The following sample shows how to assign nodes to partition grid cells simply via cell indices:
When used this way there is no need to create a PartitionGrid instance or work with it directly. For more flexibility, e.g. to use cells that span multiple columns or rows, the PartitionGrid can be used as well:
See Also
Gets or sets a mapping from edges to their preferred lengths.
Remarks
0
or a negative value, the default value from preferredEdgeLength will be used instead.Examples
Specifying a preferred length for specific edges, overriding the default setting on OrganicLayout can be accomplished easily by using the mapper property:
In cases where the preferred length can be determined by looking at the edge itself it's often easier to just set a delegate instead of preparing a mapper:
Finally, there's also the somewhat nonsensical option to use the same value for all edges, which, as the comment notes, can be achieved easier by just setting the respective property on OrganicLayout:
See Also
Sample Graphs
Gets or sets a mapping from edges to an object representing their source edge group.
Remarks
- When the star substructure style SEPARATED_RADIAL is applied, edges grouped at the root node are drawn in a grouped routing style.
- When one of the parallel substructure styles RECTANGULAR, RADIAL or STRAIGHT_LINE is applied, then edges of the parallel structures may be grouped at their outer nodes.
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
- When the star substructure style SEPARATED_RADIAL is applied, edges grouped at the root node are drawn in a grouped routing style.
- When one of the parallel substructure styles RECTANGULAR, RADIAL or STRAIGHT_LINE is applied, then edges of the parallel structures may be grouped at their outer nodes.
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
Gets or sets a mapper from non-group nodes to the computed center z-coordinate in case that a 3D layout was created.
Remarks
If this property is set, the mapper is filled by the layout with the computed z-coordinates of the non-group nodes. The node's world coordinates provides the matching x and y coordinates.
This is only required if create3DLayout is enabled. Otherwise, the algorithm produces a 2D result.
Examples
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.