Implements a layered graph layout algorithm.
Namespace: MindFusion.Graphs
File: LayeredLayout.js
JavaScript Copy Code |
---|
// class |
This algorithm assigns diagram nodes to distinct horizontal or vertical layers. While arranging the layers, the layout routine seeks to meet the following criteria:
To apply this layout to a diagram, create a LayeredLayout instance, set its members and invoke the arrange method of the Diagram class. The method lays out all subgraphs in a diagram.
The final appearance of arranged graphs depends mostly on the direction value, which defines the overall orientation of the layout. The layerDistance and nodeDistance values specify how much space to leave between adjacent layers and adjacent nodes in a layer.
The following example applies a LayeredLayout to a diagram:
JavaScript Copy Code |
---|
var layout = new MindFusion.Graphs.LayeredLayout(); layout.direction = MindFusion.Graphs.LayoutDirection.TopToBottom; layout.siftingRounds = 3; diagram.arrange(layout); |
MindFusion.Graphs.Layout
MindFusion.Graphs.LayeredLayout