C

InteractiveOrganicLayoutData

Specifies custom data for the InteractiveOrganicLayout.

Members

Show:

Constructors

Creates a new instance of InteractiveOrganicLayoutData.

Parameters

Properties

Gets a mapping that holds an InteractiveOrganicEdgeHandle for each edge in the graph.

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.

readonlyfinal

See Also

Developer's Guide
Gets or sets a mapping to define an individual initial inertia for each node.

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 of 0.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).

conversionfinal
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.
The center coordinate will be passed on to the setCenter method of InteractiveOrganicNodeHandle upon initialization. Thus, for interactive scenarios the method on the InteractiveOrganicNodeHandle itself must be used (it can be obtained via the nodeHandles property).
conversionfinal
Gets a mapping that holds an InteractiveOrganicNodeHandle for each node in the graph.

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.

readonlyfinal

See Also

Developer's Guide
Gets or sets a mapping to define an individual initial size for each node.

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).

conversionfinal
Gets or sets a mapping to define individual initial preferred lengths for edges, customizing the default length defined by defaultPreferredEdgeLength.
The preferred length will be passed on to the preferredEdgeLength property of InteractiveOrganicEdgeHandle upon initialization. Thus, for interactive scenarios where the length should be updated while layout is still running, the property of the InteractiveOrganicEdgeHandle itself must be changed (it can be obtained via the edgeHandles property).
conversionfinal

Examples

Specifying a preferred length for specific edges, accomplished by using the mapper property:

Using a mapper to set different preferred lengths for some edges
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:

Using a delegate to determine preferred edge lengths
// 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

ShownSetting: Preferred edge length 40

See Also

Developer's Guide
Gets or sets a mapping to define an individual initial stress for each node, which indicates how far a node will possibly move.

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).

conversionfinal
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.
The z-coordinate will be passed on to the setCenter3D method of InteractiveOrganicNodeHandle upon initialization. Thus, for interactive scenarios, the method on the InteractiveOrganicNodeHandle itself must be used (it can be obtained via the nodeHandles property).
conversionfinal

Methods

Combines this instance with the given layout data.
This keeps the current instance unmodified and instead returns a new instance that dynamically combines the contents of all involved instances.
final

Parameters

data: LayoutData<INode, IEdge, ILabel, ILabel>
The LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel> to combine this instance with.

Return Value

LayoutData<INode, IEdge, ILabel, ILabel>
The combined layout data.

See Also

Developer's Guide
API
CompositeLayoutData, GenericLayoutData
Writes calculated intermediate center locations of nodes to the graph and returns the largest movement applied.

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.

final

Parameters

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.

Return Value

number
the largest value a node was moved, effectively, or 0, if the calculated layout has been transferred completely

See Also

Developer's Guide