Specifies custom data for the InteractiveOrganicLayout.
Type Details
- yFiles module
- view-layout-bridge
Constructors
Creates a new instance of InteractiveOrganicLayoutData.
Parameters
A map of options to pass to the method.
- preferredEdgeLengths - ItemMapping<IEdge,number>
- A mapping to define individual initial preferred lengths for edges, customizing the default length defined by defaultPreferredEdgeLength. This option either sets the value directly or recursively sets properties to the instance of the preferredEdgeLengths property on the created object.
- nodeSizes - ItemMapping<INode,number>
- A mapping to define an individual initial size for each node. This option either sets the value directly or recursively sets properties to the instance of the nodeSizes property on the created object.
- stress - ItemMapping<INode,number>
- A mapping to define an individual initial stress for each node, which indicates how far a node will possibly move. This option either sets the value directly or recursively sets properties to the instance of the stress property on the created object.
- inertias - ItemMapping<INode,number>
- A mapping to define an individual initial inertia for each node. This option either sets the value directly or recursively sets properties to the instance of the inertias property on the created object.
- zCoordinates - ItemMapping<INode,number>
- A mapping to define an individual initial z-coordinate for each node, which will be set using setCenter3D upon creation of the handle for a node. This option either sets the value directly or recursively sets properties to the instance of the zCoordinates property on the created object.
- nodeCenters - ItemMapping<INode,Point>
- A mapping to define an individual initial center coordinates for each node, which will be set using setCenter upon creation of the handle for a node. This option either sets the value directly or recursively sets properties to the instance of the nodeCenters property on the created object.
Properties
Gets a mapping that holds an InteractiveOrganicEdgeHandle for each edge in the graph.
Remarks
A new InteractiveOrganicEdgeHandle will be created when accessing the map for the first time using a specific edge. This means that it is not necessary to explicitly create and map handles.
The InteractiveOrganicEdgeHandle is useful for interactive scenarios when updating settings of edges while the layout process is running as a consequence of changes or interactions.
Gets or sets a mapping to define an individual initial inertia for each node.
Remarks
The inertia value is defined to be a value from the interval [0,1]
.
1.0
: The node will not move.0.5
: The node will only move half as far as it would with an inertia of0.0
.0.0
: The node will move as fast as possible.
The inertia will be passed on to the inertia property of InteractiveOrganicNodeHandle upon initialization. Thus, for interactive scenarios where the inertia should be updated while layout is still running, the property of the InteractiveOrganicNodeHandle itself must be changed (it can be obtained via the nodeHandles property).
Gets or sets a mapping to define an individual initial center coordinates for each node, which will be set using setCenter upon creation of the handle for a node.
Remarks
Gets a mapping that holds an InteractiveOrganicNodeHandle for each node in the graph.
Remarks
A new InteractiveOrganicNodeHandle will be created when accessing the map for the first time using a specific node. This means that it is not necessary to explicitly create and map handles.
The InteractiveOrganicNodeHandle is useful for interactive scenarios when updating settings of nodes while the layout process is running as a consequence of changes or interactions. For example, when a node is interactively moved, this can be propagated by using setCenter and updating the stress.
Gets or sets a mapping to define an individual initial size for each node.
Remarks
The given sizes correspond to the node's diameters for the InteractiveOrganicLayout.
The halved sizes will be passed on to the radius property of InteractiveOrganicNodeHandle upon initialization. Thus, for interactive scenarios where the radius should be updated while the layout is still running, the property of the InteractiveOrganicNodeHandle itself must be changed (it can be obtained via the nodeHandles property).
Gets or sets a mapping to define individual initial preferred lengths for edges, customizing the default length defined by defaultPreferredEdgeLength.
Remarks
Examples
Specifying a preferred length for specific edges, accomplished by using the mapper property:
layoutData.preferredEdgeLengths.mapper.set(edge1, 120)
layoutData.preferredEdgeLengths.mapper.set(edge2, 75)
// All other edges not set in the mapper implicitly get the default value
// from OrganicLayout.preferredEdgeLength.
In cases where the preferred length can be determined by looking at the edge itself it's often easier to set a delegate instead of preparing a mapper:
// Ensure that there is enough space for the edge's label.
// We'll assume that every edge has a label here.
layoutData.preferredEdgeLengths = (edge) =>
edge.labels.get(0).preferredSize.width * 1.2
Sample Graphs
Gets or sets a mapping to define an individual initial stress for each node, which indicates how far a node will possibly move.
Remarks
The stress value is defined to be a value from the interval [0,1]
. The higher the stress of a node is, the farther it may move.
The stress will be passed on to the stress property of InteractiveOrganicNodeHandle upon initialization. Thus, for interactive scenarios where the stress should be updated while layout is still running, the property of the InteractiveOrganicNodeHandle itself must be changed (it can be obtained via the nodeHandles property).
Gets or sets a mapping to define an individual initial z-coordinate for each node, which will be set using setCenter3D upon creation of the handle for a node.
Remarks
Methods
Combines this instance with the given layout data.
Remarks
Parameters
A map of options to pass to the method.
- data - LayoutData<INode,IEdge,ILabel,ILabel>
- The LayoutData<TNode,TEdge,TNodeLabel,TEdgeLabel> to combine this instance with.
Returns
- ↪LayoutData<INode,IEdge,ILabel,ILabel>
- The combined layout data.
See Also
Defined in
Writes calculated intermediate center locations of nodes to the graph
and returns the largest movement applied.
Remarks
This method queries the node locations from the nodeHandles mapped which will have been updated by the running layout algorithm. It should be regularly called to make sure that changes are applied to the graph and become visible for the user.
The movement will be calculated as (movement) = (ratio) * (distance between calculated and actual location)
The returned largest movement can be used for estimating the difference between calculated layout and actual positions. If the return value is 0
, the calculated layout was completely transferred.
Parameters
A map of options to pass to the method.
- graph - IGraph
- The graph to adjust the node's positions for.
- max - number
- the maximum distance a node will be moved in world coordinates. Defaults to
50
. - ratio - number
- a factor that determines the node movement as a ratio between the current location and the final location. Defaults to
0.05
. - minMovement - number
- The minimal distance a node should be apart from its destination so that it will be moved, at all. Defaults to
1.5
.
Returns
- ↪number
- the largest value a node was moved, effectively, or
0
, if the calculated layout has been transferred completely