C

FromSketchLayerAssigner

FromSketchLayerAssigner assigns nodes to layers by analyzing already existing node coordinates.
ImplementsInheritance Hierarchy

Remarks

Nodes whose bounds overlap in the main layout direction are assigned to the same layer. To influence to which amount the boxes need to overlap, the nodes can temporarily be scaled. Alternatively, a minimum and maximum size or margins can be specified for the nodes.

Initial graph

Hierarchical layout when the initial drawing is used as sketch

Hierarchical layout when the initial drawing is not used as sketch

Default Values of Properties

NameDefault
maximumNodeSizeNumber.MAX_VALUE
minimumNodeSize0.0
nodeMargin0.0d
nodeScalingFactor1.0

See Also

Developer's Guide

Members

Show:

Constructors

Creates an instance of FromSketchLayerAssigner with default settings.

Parameters

Properties

Gets or sets the maximum size of a node used for calculating layer overlaps.

This can be used for more fuzzy layering.

The maximum size can take positive values.

final

Property Value

a positive double value

Throws

Exception ({ name: 'ArgumentError' })
if the specified value is less than 0

Default Value

The default value is: Number.MAX_VALUE

Sample Graphs

ShownSetting: Initial graph

See Also

API
nodeScalingFactor, nodeMargin
Gets or sets the minimum size of a node used for calculating layer overlaps.

This can be used for more fuzzy layering.

The minimum size can take positive values.

final

Property Value

a positive double value

Throws

Exception ({ name: 'ArgumentError' })
if the specified value is less than 0

Default Value

The default value is: 0.0

Sample Graphs

ShownSetting: Initial graph

See Also

API
nodeScalingFactor, nodeMargin
Gets or sets the size of the margins around a node which is used for calculating layer overlaps.

If the value of the margin is positive, it specifies a border around a node. In case it is negative, it is considered as an inset that defines a smaller area inside the node.

This can be used for more fuzzy layering.

final

Property Value

the size of a node's margin

Default Value

The default value is: 0.0d

Sample Graphs

ShownSetting: Initial graph

See Also

API
nodeScalingFactor, minimumNodeSize, maximumNodeSize
Gets or sets the scaling factor used for scaling the size of the nodes.

Nodes are being scaled from their center. This can be used for more fuzzy layering.

The scaling factor can take positive values. Factors smaller than 1 only consider large overlaps of the nodes' bounds in the main layout direction. Factors larger than 1 also combine nodes with some distance between them.

final

Property Value

a positive double value

Throws

Exception ({ name: 'ArgumentError' })
if the specified value is less than 0

Default Value

The default value is: 1.0

Sample Graphs

ShownSetting: Initial graph

See Also

API
minimumNodeSize, maximumNodeSize, nodeMargin

Methods

Assigns all nodes of the graph to layers by analyzing already existing node coordinates and adds them to the layers instance in the given layoutContext.
Nodes whose bounds overlap in the main layout direction are assigned to the same layer. To influence to which amount the boxes need to overlap, the nodes can temporarily be scaled.
final

Parameters

graph: LayoutGraph
the input graph
layoutContext: HierarchicalLayoutContext
the HierarchicalLayoutContext used for querying information about the nodes and edges
Callback used for calculating the lower (max) value of a given node.
protected

Parameters

graph: LayoutGraph
The graph
node: LayoutNode
The node

Return Value

number
The lower (max) value of a given node
Callback used for calculating the upper (min) value of a given node.
protected

Parameters

graph: LayoutGraph
The graph
node: LayoutNode
The node

Return Value

number
The upper (min) value of a given node