Search
TreeLayout Class
Remarks See Also
 






Implements algorithms for arranging tree structures.

Namespace: MindFusion.Graphs
File: TreeLayout.js

 Syntax

JavaScript  Copy Code

// class
TreeLayout.prototype = {}

 Remarks

To apply this layout to a diagram, create a TreeLayout instance, set its members and invoke the arrange method of the Diagram class. The method lays out all subtrees in a diagram.

As long as the graph is a tree, the algorithm can find the root node automatically. The distance between the root and the second level and between all subsequent levels can be set through the levelDistance field. The distance between adjacent nodes in the same level is set through nodeDistance.

In addition to arranging the tree nodes, TreeLayout also sets the shape of links as set through its linkType property.

 Example

The following example applies a TreeLayout to a diagram:

JavaScript  Copy Code

var layout = new MindFusion.Graphs.TreeLayout();
layout.direction = MindFusion.Graphs.LayoutDirection.TopToBottom;
linkType = MindFusion.Graphs.TreeLayoutLinkType.Cascading;
diagram.arrange(layout);

 Inheritance Hierarchy

MindFusion.Graphs.Layout
    MindFusion.Graphs.TreeLayout

 See Also