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
columnMode | false | The layout is wrapped horizontally, producing rows. |
coreLayout | null | |
edgeSpacing | 5 | |
fixedWidthLineBreaks | false | The target aspect ratio defines how the line width is chosen. |
mirror | true | Every other line is mirrored. |
spacing | 10 | |
targetRatio | 1 |
Type Details
- yFiles module
- algorithms
Constructors
Creates a new LineWrappingStage instance with default settings.
Parameters
A map of options to pass to the method.
- edgeSpacing - number
- The space that should be kept between edges. This option sets the edgeSpacing property on the created object.
- columnMode - boolean
- Whether this ILayoutStage wraps lines/rows or columns. This option sets the columnMode property on the created object.
- spacing - number
- The space between adjacent lines of the wrapped graph layout. This option sets the spacing property on the created object.
- mirror - boolean
- Whether or not every other line is mirrored. This option sets the mirror property on the created object.
- fixedWidthLineBreaks - boolean
- Whether the algorithm should use the fixedWidth or target aspect ratio to determine line breaks. This option sets the fixedWidthLineBreaks property on the created object.
- targetRatio - number
- The desired target aspect ratio for the layout. This option sets the targetRatio property on the created object.
- fixedWidth - number
- The desired width of the lines. This option sets the fixedWidth property on the created object.
- enabled - boolean
- coreLayout - ILayoutAlgorithm
- The core ILayoutAlgorithm that is wrapped by this stage. This option sets the coreLayout property on the created object.
Properties
Gets or sets whether this ILayoutStage wraps lines/rows or columns.
Remarks
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.
Default Value
false
.The layout is wrapped horizontally, producing rows.
Property Value
true
for column wrapping mode, false
for row wrappingSee Also
Gets or sets the core ILayoutAlgorithm that is wrapped by this stage.
Gets or sets the space that should be kept between edges.
Remarks
Default Value
5
.Property Value
Throws
- Exception({ name: 'ArgumentError' })
- if the given spacing is a negative value
Sample Graphs
Gets or sets a value that determines whether this stage should do anything but execute the coreLayout.
Remarks
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.
Implements
Gets or sets the desired width of the lines.
Remarks
The LineWrappingStage breaks the lines at the specified width.
In columnMode, the fixed width is interpreted as fixed height for a column.
Default Value
500
.Property Value
See Also
Sample Graphs
true
.Gets or sets whether the algorithm should use the fixedWidth or target aspect ratio to determine line breaks.
Default Value
false
.The target aspect ratio defines how the line width is chosen.
Property Value
true
if a fixed line width is used, false
otherwiseSee Also
Gets or sets whether or not every other line is mirrored.
Remarks
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.Default Value
true
.Every other line is mirrored.
Property Value
true
if every second line is rotated by 180
degrees, false
otherwiseSample Graphs
Gets or sets the space between adjacent lines of the wrapped graph layout.
Remarks
If the columnMode is enabled, this spacing defines the distance between adjacent columns.
The spacing should be non-negative.
Default Value
10
.Property Value
Throws
- Exception({ name: 'ArgumentError' })
- if the spacing is negative
Sample Graphs
Gets or sets the desired target aspect ratio for the layout.
Remarks
0
.Default Value
1
.Property Value
width/height
Throws
- Exception({ name: 'ArgumentError' })
- if the target ratio is
0
or less
See Also
Sample Graphs
false
.Methods
Implementation of the ILayoutAlgorithm interface and main entry point for the layout calculation.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- The graph to apply the layout to.
Implements
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.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- The input graph