mxRadialTreeLayout

Extends mxGraphLayout to implement a radial tree algorithm.  This layout is suitable for graphs that have no cycles (trees).  Vertices that are not connected to the tree will be ignored by this layout.

Example

var layout = new mxRadialTreeLayout(graph);
layout.execute(graph.getDefaultParent());
Summary
mxRadialTreeLayoutExtends mxGraphLayout to implement a radial tree algorithm.
Functions
mxRadialTreeLayoutConstructs a new radial tree layout for the specified graph
Variables
angleOffsetThe initial offset to compute the angle position.
rootxThe X co-ordinate of the root cell
rootyThe Y co-ordinate of the root cell
levelDistanceHolds the levelDistance.
nodeDistanceHolds the nodeDistance.
autoRadiusSpecifies if the radios should be computed automatically
sortEdgesSpecifies if edges should be sorted according to the order of their opposite terminal cell in the model.
rowMinXArray of leftmost x coordinate of each row
rowMaxXArray of rightmost x coordinate of each row
rowMinCenXArray of x coordinate of leftmost vertex of each row
rowMaxCenXArray of x coordinate of rightmost vertex of each row
rowRadiArray of y deltas of each row behind root vertex, also the radius in the tree
rowArray of vertices on each row
Functions
isVertexIgnoredReturns a boolean indicating if the given mxCell should be ignored as a vertex.
executeImplements mxGraphLayout.execute.
calcRowDimsRecursive function to calculate the dimensions of each row

Functions

mxRadialTreeLayout

function mxRadialTreeLayout(graph)

Constructs a new radial tree layout for the specified graph

Variables

angleOffset

mxRadialTreeLayout.prototype.angleOffset

The initial offset to compute the angle position.

rootx

mxRadialTreeLayout.prototype.rootx

The X co-ordinate of the root cell

rooty

mxRadialTreeLayout.prototype.rooty

The Y co-ordinate of the root cell

levelDistance

mxRadialTreeLayout.prototype.levelDistance

Holds the levelDistance.  Default is 120.

nodeDistance

mxRadialTreeLayout.prototype.nodeDistance

Holds the nodeDistance.  Default is 10.

autoRadius

mxRadialTreeLayout.prototype.autoRadius

Specifies if the radios should be computed automatically

sortEdges

mxRadialTreeLayout.prototype.sortEdges

Specifies if edges should be sorted according to the order of their opposite terminal cell in the model.

rowMinX

mxRadialTreeLayout.prototype.rowMinX

Array of leftmost x coordinate of each row

rowMaxX

mxRadialTreeLayout.prototype.rowMaxX

Array of rightmost x coordinate of each row

rowMinCenX

mxRadialTreeLayout.prototype.rowMinCenX

Array of x coordinate of leftmost vertex of each row

rowMaxCenX

mxRadialTreeLayout.prototype.rowMaxCenX

Array of x coordinate of rightmost vertex of each row

rowRadi

mxRadialTreeLayout.prototype.rowRadi

Array of y deltas of each row behind root vertex, also the radius in the tree

row

mxRadialTreeLayout.prototype.row

Array of vertices on each row

Functions

isVertexIgnored

mxRadialTreeLayout.prototype.isVertexIgnored = function(vertex)

Returns a boolean indicating if the given mxCell should be ignored as a vertex.  This returns true if the cell has no connections.

Parameters

vertexmxCell whose ignored state should be returned.

execute

mxRadialTreeLayout.prototype.execute = function(parent,
root)

Implements mxGraphLayout.execute.

If the parent has any connected edges, then it is used as the root of the tree.  Else, mxGraph.findTreeRoots will be used to find a suitable root node within the set of children of the given parent.

Parameters

parentmxCell whose children should be laid out.
rootOptional mxCell that will be used as the root of the tree.

calcRowDims

mxRadialTreeLayout.prototype.calcRowDims = function(row,
rowNum)

Recursive function to calculate the dimensions of each row

Parameters

rowArray of internal nodes, the children of which are to be processed.
rowNumInteger indicating which row is being processed.
Base class for all layout algorithms in mxGraph.
function mxRadialTreeLayout(graph)
Constructs a new radial tree layout for the specified graph
mxRadialTreeLayout.prototype.angleOffset
The initial offset to compute the angle position.
mxRadialTreeLayout.prototype.rootx
The X co-ordinate of the root cell
mxRadialTreeLayout.prototype.rooty
The Y co-ordinate of the root cell
mxRadialTreeLayout.prototype.levelDistance
Holds the levelDistance.
mxRadialTreeLayout.prototype.nodeDistance
Holds the nodeDistance.
mxRadialTreeLayout.prototype.autoRadius
Specifies if the radios should be computed automatically
mxRadialTreeLayout.prototype.sortEdges
Specifies if edges should be sorted according to the order of their opposite terminal cell in the model.
mxRadialTreeLayout.prototype.rowMinX
Array of leftmost x coordinate of each row
mxRadialTreeLayout.prototype.rowMaxX
Array of rightmost x coordinate of each row
mxRadialTreeLayout.prototype.rowMinCenX
Array of x coordinate of leftmost vertex of each row
mxRadialTreeLayout.prototype.rowMaxCenX
Array of x coordinate of rightmost vertex of each row
mxRadialTreeLayout.prototype.rowRadi
Array of y deltas of each row behind root vertex, also the radius in the tree
mxRadialTreeLayout.prototype.row
Array of vertices on each row
mxRadialTreeLayout.prototype.isVertexIgnored = function(vertex)
Returns a boolean indicating if the given mxCell should be ignored as a vertex.
Cells are the elements of the graph model.
mxRadialTreeLayout.prototype.execute = function(parent,
root)
Implements mxGraphLayout.execute.
mxGraphLayout.prototype.execute = function(parent)
Executes the layout algorithm for the children of the given parent.
mxRadialTreeLayout.prototype.calcRowDims = function(row,
rowNum)
Recursive function to calculate the dimensions of each row
mxGraph.prototype.findTreeRoots = function(parent,
isolate,
invert)
Returns all children in the given parent which do not have incoming edges.
Close