C

TreeLayoutPortAssigner

The TreeLayoutPortAssigner provides some simple port assignment styles for the TreeLayout.
ImplementsInheritance Hierarchy

Remarks

Ports are either CENTERed on the node, distributed at one side of the node, or placed considering LayoutPortCandidates.

Default Values of Properties

NameDefaultDescription
borderToPortGapRatio0.5
modeTreeLayoutPortAssignmentMode.CENTER
reversedPortOrderfalse
The normal order is used for the ports.

See Also

Developer's Guide

Members

Show:

Constructors

Creates a new TreeLayoutPortAssigner instance.

Parameters

mode?: TreeLayoutPortAssignmentMode
An optional port assignment specifier. The default value is CENTER.
ratio?: number
The ratio of the distance between outer ports and the border to the distance between any two ports. The default value is 0.5.

Throws

Exception ({ name: 'ArgumentError' })
if an unknown mode is specified or if the specified ratio is negative

Properties

Gets or sets the ratio of the border gap (distance between the outer ports to the node border) to the port gap (distance between adjacent ports).
The ratio must have a positive value. When the ratio is 0, the ports will be distributed along the whole side of the node without a gap between the last port and the corner.
This setting only affects DISTRIBUTED port assignment.
final

Property Value

the ratio of the border gap (gap between ports and border) to the port gap (gap between two ports)

Throws

Exception ({ name: 'ArgumentError' })
if the specified ratio is negative

Default Value

The default value is: 0.5

Sample Graphs

ShownSetting: 0.5
Gets or sets the mode that describes how ports are placed.
While ISubtreePlacer implementations preserve the assigned ports, some may not generate suitable edge routes when ports are distributed. For distributed ports, SingleLayerSubtreePlacer typically yields the best results.
conversionfinal

Property Value

one of the predefined port assignment specifiers

Default Value

See Also

Developer's Guide
Gets or sets whether or not the port assignment should reverse the order of the ports.
The normal order is from left to right and from top to bottom. It will be reversed if this option is enabled.
This setting only affects DISTRIBUTED port assignment.
final

Property Value

true if the order of the ports is reversed, false otherwise

Default Value

The default value is: false
The normal order is used for the ports.

Sample Graphs

ShownSetting: false

Methods

Assigns relative coordinates to the source port of the outgoing edge to a child of the given node.
This method is called by assignPorts for each outgoing edge of the given node. It may be overridden to assign a custom location to the source port of outgoing edges.
This implementation considers LayoutPortCandidates despite the port assignment mode.
protected

Parameters

graph: LayoutGraph
the input graph
node: LayoutNode
the node
edge: LayoutEdge
the edge to the child node
index: number
the zero-based index of the child edge

See Also

API
sourcePortOffset
Assigns relative coordinates to the target port of the incoming edge from the parent of the given node.
This method is called by assignPorts if the given node has a parent node. It may be overridden to assign a custom location to the target port of the incoming edge.
This implementation considers LayoutPortCandidates despite the port assignment mode.
protected

Parameters

graph: LayoutGraph
the input graph
node: LayoutNode
the node
edge: LayoutEdge
the edge from the parent node

See Also

API
targetPortOffset
Places the ports of edges connecting to the given node according to the port assignment mode.

Parameters

graph: LayoutGraph
the input graph
node: LayoutNode
the node whose adjacent edges' ports should be placed

See Also

API
mode