Members
Constructors
Properties
Gets or sets the mapping from partial nodes to an object defining their component assignment.
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.
See Also
Gets or sets the LayoutGrid layout data.
Gets or sets the mapping from nodes to their margins.
Examples
The easiest option is to reserve the same space around all nodes, by setting a constant value:
layoutData.nodeMargins = new Insets(20)Handling only certain nodes differently can be done easily by using the mapper property:
// 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 spaceIn 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:
// Retrieve the space around the node from its tag property
layoutData.nodeMargins = (node: INode): Insets =>
new Insets(parseFloat(node.tag))See Also
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.
Gets or sets the collection of nodes and edges that are considered as partial (movable) by the layout.
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>:
layoutData.scope.nodes = graphComponent.selection.nodesAlternatively, 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:
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:
layoutData.scope.nodes = (node) => graphComponent.selection.includes(node)See Also
Developer's Guide
API
- NODE_SCOPE_DATA_KEY, EDGE_SCOPE_DATA_KEY
Methods
combineWith
(data: LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel>): LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel>Combines this instance with the given layout data.
combineWith
(data: LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel>): LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel>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