C

LineWrappingStage

LineWrappingStage can line-wrap or column-wrap a graph layout.

Remarks

This ILayoutStage supports both wrapping a layout at a given width (height) and wrapping a layout automatically at some width (height) such that the resulting overall aspect ratio is close to a desired targetRatio.

The LineWrappingStage can be used on an existing graph layout or on the result of the coreLayout.

Default Values of Properties

NameDefaultDescription
columnModefalse
The layout is wrapped horizontally, producing rows.
coreLayoutnull
edgeSpacing5
fixedWidthLineBreaksfalse
The target aspect ratio defines how the line width is chosen.
mirrortrue
Every other line is mirrored.
spacing10
targetRatio1

See Also

Developer's Guide

Members

Show:

Constructors

Creates a new LineWrappingStage instance with default settings.

Parameters

Properties

Gets or sets whether this ILayoutStage wraps lines/rows or columns.

If this mode is enabled, the layout is wrapped vertically and new columns are appended to the right of the first column. Otherwise, the layout is wrapped horizontally and new rows are appended below the first row.

Also, the fixedWidth property will be interpreted as a fixed height if this mode is enabled.

final

Property Value

true for column wrapping mode, false for row wrapping

Default Value

The default value is: false
The layout is wrapped horizontally, producing rows.

See Also

Developer's Guide
API
fixedWidth
Gets or sets the core ILayoutAlgorithm that is wrapped by this stage.
final

Property Value

the core layout routine

Default Value

The default value is: null
Gets or sets the space that should be kept between edges.
The spacing must be non-negative.
final

Property Value

the space between edges

Throws

Exception ({ name: 'ArgumentError' })
if the given spacing is a negative value

Default Value

The default value is: 5

Sample Graphs

ShownSetting: 5

See Also

Developer's Guide
Gets or sets a value that determines whether this stage should do anything but execute the coreLayout.

By default, when constructed, stages should be enabled. Users may disable a stage's functionality by setting this property to false.

Stages that can guarantee that the graph will not change can choose to not even execute the coreLayout when disabled.

final
Gets or sets the desired width of the lines.

The LineWrappingStage breaks the lines at the specified width.

In columnMode, the fixed width is interpreted as fixed height for a column.

The algorithm will not necessarily be able to satisfy very small values, since the nodes need to fit completely into a line.
The specified width is only considered if fixedWidthLineBreaks returns true.
final

Property Value

the width of the lines

Default Value

The default value is: 500

Sample Graphs

ShownSetting: 500

See Also

Developer's Guide
API
fixedWidthLineBreaks, columnMode
Gets or sets whether the algorithm should use the fixedWidth or target aspect ratio to determine line breaks.
final

Property Value

true if a fixed line width is used, false otherwise

Default Value

The default value is: false
The target aspect ratio defines how the line width is chosen.

See Also

Developer's Guide
API
fixedWidth, targetRatio
Gets or sets whether or not every other line is mirrored.
When breaking a line and placing the remaining line below, this remainder can be rotated by 180 degrees. Then, the edges connecting both lines stay short. In case the remainder is not rotated, the edges are routed between the two lines to connect to the front of the non-mirrored line.
final

Property Value

true if every second line is rotated by 180 degrees, false otherwise

Default Value

The default value is: true
Every other line is mirrored.

Sample Graphs

ShownSetting: false

See Also

Developer's Guide
Gets or sets the space between adjacent lines of the wrapped graph layout.

If the columnMode is enabled, this spacing defines the distance between adjacent columns.

The spacing should be non-negative.

final

Property Value

the space between the lines

Throws

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

Default Value

The default value is: 10

Sample Graphs

ShownSetting: 10

See Also

Developer's Guide
Gets or sets the desired target aspect ratio for the layout.
The aspect ratio needs to be greater than 0.
The specified width is only considered if fixedWidthLineBreaks returns false.
final

Property Value

the desired target aspect ratio in terms of width/height

Throws

Exception ({ name: 'ArgumentError' })
if the target ratio is 0 or less

Default Value

The default value is: 1

Sample Graphs

ShownSetting: 0.5

See Also

Developer's Guide
API
fixedWidthLineBreaks

Methods

Implementation of the ILayoutAlgorithm interface and main entry point for the layout calculation.
This implementation checks the enabled state and when it's not enabled, will delegate to the coreLayout, directly. When the stage is enabled, all the work will be delegated to applyLayoutImpl, instead.
final

Parameters

graph: LayoutGraph
The graph to apply the layout to.
Cuts the layout resulting from the coreLayout at a specified width/height and shifts the remaining graph into the next row/column until the layout has the desired width/height.
protected

Parameters

graph: LayoutGraph
The input graph