Class GraphLayoutLineWrapper

Class GraphLayoutLineWrapper is a layout algorithm that can be used to "line-wrap" respectively "column-wrap" a graph layout. It allows, for example, to specify a desired aspect ratio for a wrapped layout, or a fixed width (height) for the lines (columns) of a wrapped layout.

GraphLayoutLineWrapper is realized as a layout stage, i.e., it is an extension of abstract class AbstractLayoutStage.

Most commonly, class GraphLayoutLineWrapper is used in conjunction with hierarchical layouts. Figure 5.9, “Hierarchical layout before and after line-wrapping” presents a hierarchical layout that has been line-wrapped to achieve a desired aspect ratio.

Figure 5.9. Hierarchical layout before and after line-wrapping

Sample hierarchical layout.
Extended hierarchical left-to-right layout.
The same graph line-wrapped.
The same graph line-wrapped so that width and height are nearly the same, i.e., an aspect ratio of 1.0 is nearly achieved.

Example 5.16, “Using GraphLayoutLineWrapper in conjunction with hierarchical layout” shows how class GraphLayoutLineWrapper can be used to wrap hierarchical top-to-bottom layouts.

Example 5.16. Using GraphLayoutLineWrapper in conjunction with hierarchical layout

var gllw:GraphLayoutLineWrapper = new GraphLayoutLineWrapper();
gllw.columnMode = true;
gllw.mirror = false;
// Use grouping-aware hierarchical layout as the core layouter.
gllw.coreLayouter = new IncrementalHierarchicLayouter();

// Invoke the layouter.
CopiedLayoutIGraph.applyLayout(graph, gllw);

Layout Options

GraphLayoutLineWrapper provides a set of options that influence its behavior.

Column Mode
API
columnMode:Boolean
Description Determines whether the graph layout should be column-wrapped instead of line-wrapped.
Spacing
API
spacing:Number
Description Defines the spacing between adjacent lines (columns) of the line-wrapped (column-wrapped) graph layout.
Edge Spacing
API
edgeSpacing:Number
Description Defines the spacing between adjacent edge paths that connect consecutive lines (columns) of the line-wrapped (column-wrapped) graph layout.
Mirroring
API
mirror:Boolean
Description Determines whether the lines (columns) of the line-wrapped (column-wrapped) graph layout should be arranged in an alternating manner so that every second line (column) goes from right to left (bottom to top) instead of left to right (top to bottom).
Pre-set vs. Automatic Line Width (Column Height)
API
fixedWidthLineBreaks:Boolean
Description Determines whether the lines (columns) of the line-wrapped (column-wrapped) graph layout should use the width (height) as set using fixedWidth.
Fixed Line Width (Column Height)
API
fixedWidth:Number
Description Defines the width (height) that should be used for the lines (columns) of the line-wrapped (column-wrapped) graph layout. This setting only has an effect if pre-set line width (column height) is enabled.
Aspect Ratio
API
targetRatio:Number
Description Defines the desired aspect ratio that should be achieved for the line-wrapped (column-wrapped) graph layout. This setting only has an effect if automatic line width (column height) is enabled.