C

PartialLayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel>

Specifies custom data for the PartialLayout.
Inheritance Hierarchy

Members

Show:

Constructors

Parameters

Properties

Gets or sets the mapping from partial nodes to an object defining their component assignment.
All partial nodes associated with the same object are assigned to the same subgraph component.
If custom components are specified, the componentAssignmentStrategy will be ignored.
Nodes of a subgraph component cannot be assigned to different group nodes or different layout grid cells.
conversionfinal

See Also

Developer's Guide
API
COMPONENT_ID_DATA_KEY, componentAssignmentStrategy
Gets or sets the mapping from edges to their orientation, specifying how they should be routed with respect to the main layout direction.

The orientation of an edge is 1 if it should be routed in the main layout direction, -1 if it should be routed against the main layout direction, or 0 if it should be routed independently of the main layout direction.

The main layout orientation can be set using method layoutOrientation.

If left unspecified, the algorithm assumes that all edges are considered to be directed.
The orientation of edges only has an effect if the layoutOrientation is not set to NONE
conversionfinal

See Also

API
EDGE_ORIENTATION_DATA_KEY
Gets or sets the LayoutGrid layout data.
The PartialLayout doesn't support multiple grids, i.e., all nodes have to be mapped to cells of the same layoutGrid.
final
Gets or sets the mapping from nodes to their margins.
Node margins allow to reserve space around nodes.
conversionfinal

Examples

The easiest option is to reserve the same space around all nodes, by setting a constant value:

Using constant space around all nodes
layoutData.nodeMargins = new Insets(20)

Handling only certain nodes differently can be done easily by using the mapper property:

Using a mapper to set margins for certain nodes
// node1 only reserves space above and below
layoutData.nodeMargins.mapper.set(node1, new Insets(20, 10, 0, 0))
// node2 has space all around
layoutData.nodeMargins.mapper.set(node2, new Insets(25))
// all other nodes don't get extra space

In cases where the nodeMargins for each node can be determined by looking at the node itself it's often easier to just set a mapperFunction instead of preparing a mapper:

Using a delegate to determine margins for all nodes
// Retrieve the space around the node from its tag property
layoutData.nodeMargins = (node: INode): Insets =>
  new Insets(parseFloat(node.tag))

See Also

API
NODE_MARGIN_DATA_KEY
Gets or sets the sub-data that provides a way of influencing the placement of the ports.

The port placement can be influenced by specifying EdgePortCandidates for the source and target of an edge, as well as by specifying NodePortCandidates at the nodes.

In addition, it is possible to specify that ports should be grouped at the source or target.

If both EdgePortCandidates and NodePortCandidates are specified, the layout algorithm tries to match them. The exact procedure depends on the specified coreLayout and the specified edgeRouter.

final
Gets or sets the collection of nodes and edges that are considered as partial (movable) by the layout.
All edges with at least one partial endpoint (source or target node) are automatically considered to be partial.
readonlyfinal

Examples

Defining the subset of nodes that should be partial 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 collection or IEnumerable<T>:

Setting a collection of affected nodes
layoutData.scope.nodes = graphComponent.selection.nodes

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:

Adding individual nodes and edges
layoutData.scope.nodes.items.add(partialNode1)
layoutData.scope.nodes.items.add(partialNode2)
layoutData.scope.edges.items.add(graph.edges.first()!)

A powerful option that doesn't use a collection is to use the predicate to set a custom delegate that returns for every node or edge whether it is contained in the set or not:

Using a delegate to specify all selected nodes as partial nodes
layoutData.scope.nodes = (node) => graphComponent.selection.includes(node)

See Also

Developer's Guide
API
NODE_SCOPE_DATA_KEY, EDGE_SCOPE_DATA_KEY

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<TNode, TEdge, TNodeLabel, TEdgeLabel>
The LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel> to combine this instance with.

Return Value

LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel>
The combined layout data.

See Also

Developer's Guide
API
CompositeLayoutData, GenericLayoutData