Class RadialTreeLayout

Extends CompactTreeLayout 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.

const layout = new RadialTreeLayout(graph);
layout.execute(graph.getDefaultParent());

Hierarchy (view full)

Constructors

Properties

alignRanks: boolean = false

Whether or not the tops of cells in each rank should be aligned across the rank

angleOffset: number = 0.5

The initial offset to compute the angle position.

0.5
autoRadius: boolean = false

Specifies if the radios should be computed automatically

false
centerX: null | number = null
centerY: null | number = null
channelBuffer: number = 4

The size of the vertical buffer in the center of inter-rank channels where edge control points should not be placed.

edgeRouting: boolean = true

Whether or not to apply the internal tree edge routing.

graph: Graph

Reference to the enclosing Graph.

groupPadding: number = 10

Padding added to resized parents.

10
groupPaddingBottom: number = 0

Bottom padding added to resized parents.

0
groupPaddingLeft: number = 0

Left padding added to resized parents.

0
groupPaddingRight: number = 0

Right padding added to resized parents.

0
groupPaddingTop: number = 0

Top padding added to resized parents.

0
horizontal: boolean = true

Specifies the orientation of the layout.

true
invert: boolean = false

Specifies if edge directions should be inverted.

false.
levelDistance: number = 120

Holds the levelDistance.

120
maintainParentLocation: boolean = false

Specifies if the parent location should be maintained, so that the top, left corner stays the same before and after execution of the layout. Default is false for backwards compatibility.

false
maxRankHeight: Cell[] = []

An array of the maximum height of cells (relative to the layout direction) per rank

minEdgeJetty: number = 8

The minimum distance for an edge jetty from a vertex.

moveTree: boolean = false

Specifies if the tree should be moved to the top, left corner if it is inside a top-level layer.

false
node: null | _mxCompactTreeLayoutNode = null

The internal node representation of the root cell. Do not set directly , this value is only exposed to assist with post-processing functionality

nodeDistance: number = 10

Holds the nodeDistance.

10
parent: null | Cell = null

The parent cell of the layout, if any

null
parentsChanged: null | {
    [id: string]: Cell;
} = null

A set of the parents that need updating based on children process as part of the layout.

parentX: null | number = null
parentY: null | number = null
prefHozEdgeSep: number = 5

The preferred horizontal distance between edges exiting a vertex.

prefVertEdgeOff: number = 4

The preferred vertical offset between edges exiting a vertex.

resetEdges: boolean = true

Specifies if all edge points of traversed edges should be removed.

true
resizeParent: boolean = true

If the parents should be resized to match the width/height of the children. Default is true.

true
root: null | Cell = null

The cell to use as the root of the tree

rootx: number = 0

The X co-ordinate of the root cell

0
rooty: number = 0

The Y co-ordinate of the root cell

0
row: _mxCompactTreeLayoutNode[][] = []

Array of vertices on each row

rowMaxCenX: {
    [key: number]: number;
} = {}

Array of x coordinate of rightmost vertex of each row

rowMaxX: {
    [key: number]: number;
} = {}

Array of rightmost x coordinate of each row

rowMinCenX: {
    [key: number]: number;
} = {}

Array of x coordinate of leftmost vertex of each row

rowMinX: {
    [key: number]: number;
} = {}

Array of leftmost x coordinate of each row

rowRadi: {
    [key: number]: number;
} = {}

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

sortEdges: boolean = false

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

false
useBoundingBox: boolean = true

Boolean indicating if the bounding box of the label should be used if it iss available.

true.
visited: {
    [key: string]: Cell;
} = {}

Methods

  • Recursive function to calculate the dimensions of each row

    Parameters

    • row: _mxCompactTreeLayoutNode[]

      Array of internal nodes, the children of which are to be processed.

    • rowNum: number

      Integer indicating which row is being processed.

    Returns void

  • Does a depth first search starting at the specified cell. Makes sure the specified parent is never left by the algorithm.

    Parameters

    Returns null | _mxCompactTreeLayoutNode

  • Implements GraphLayout#execute.

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

    Parameters

    • parent: Cell

      mxCell whose children should be laid out.

    • root: null | Cell = null

      Optional mxCell that will be used as the root of the tree.

    Returns void

  • Returns the constraint for the given key and cell. The optional edge and source arguments are used to return inbound and outgoing routing- constraints for the given edge and vertex. This implementation always returns the value for the given key in the style of the given cell.

    Parameters

    • key: string

      Key of the constraint to be returned.

    • cell: Cell

      Cell whose constraint should be returned.

    • Optionaledge: Cell

      Optional Cell that represents the connection whose constraint should be returned. Default is null.

    • Optionalsource: boolean

      Optional boolean that specifies if the connection is incoming or outgoing. Default is null.

    Returns any

  • Returns true if the given parent is an ancestor of the given child.

    Parameters

    • parent: Cell

      Cell that specifies the parent.

    • child: null | Cell

      Cell that specifies the child.

    • OptionaltraverseAncestors: boolean

      boolean whether to

    Returns boolean

  • Notified when a cell is being moved in a parent that has automatic layout to update the cell state (eg. index) so that the outcome of the layout will position the vertex as close to the point (x, y) as possible.

    Empty implementation.

    Parameters

    • cell: Cell

      Cell which has been moved.

    • x: number

      X-coordinate of the new cell location.

    • y: number

      Y-coordinate of the new cell location.

    Returns void

  • Sets the new position of the given cell taking into account the size of the bounding box if useBoundingBox is true. The change is only carried out if the new location is not equal to the existing location, otherwise the geometry is not replaced with an updated instance. The new or old bounds are returned (including overlapping labels).

    Parameters

    • cell: Cell

      Cell whose geometry is to be set.

    • x: number

      Integer that defines the x-coordinate of the new location.

    • y: number

      Integer that defines the y-coordinate of the new location.

    Returns null | Rectangle

  • Traverses the (directed) graph invoking the given function for each visited vertex and edge. The function is invoked with the current vertex and the incoming edge as a parameter. This implementation makes sure each vertex is only visited once. The function may return false if the traversal should stop at the given vertex.

    Example:

    GlobalConfig.logger.show();
    const cell = graph.getSelectionCell();
    graph.traverse(cell, false, function(vertex, edge)
    {
    GlobalConfig.logger.debug(graph.getLabel(vertex));
    });

    Parameters

    • __namedParameters: GraphLayoutTraverseArgs

    Returns void