Interface HierarchyLayoutParameters

Optional parameters for a Hierarchy layout

interface HierarchyLayoutParameters {
    absoluteBacked?: boolean;
    alignment?: "center" | "end" | "start";
    axis?: "horizontal" | "vertical";
    edgeFilter?: ((e) => boolean);
    gatherUnattachedRoots?: boolean;
    generateRouting?: boolean;
    getRootNode?: (() => AbstractEdgeTerminus);
    height?: number;
    invert?: boolean;
    locationFunction?: LocationFunction;
    maxIterations?: number;
    maxIterationsWithoutImprovement?: number;
    padding?: PointXY;
    placementStrategy?: "center" | "end" | "start" | "parent";
    respectEdgeDirection?: boolean;
    rootNode?: any;
    width?: number;
}

Hierarchy (view full)

Properties

absoluteBacked?: boolean

Defaults to false. If true, then the layout will use any position values found in the data for a given vertex.

alignment?: "center" | "end" | "start"

Optional, defaults to HierarchyLayoutAlignmentValues.center. Instructs the layout how to place child nodes with respect to their parent nodes. By default, a group of child nodes is centered on its parent. The layout also supports "start" and "end" for this value, which work in much the same way as "flex-start" and "flex-end" do in CSS: for a layout with the root at the top of the tree and the child nodes underneath, a value of "start" for align would cause the first child of the root to be placed immediately under the root, with its first child immediately underneath, etc. The remainder of the content would fan out to the right. This option also works in conjunction with invert and axis:HierarchyLayoutAxisValues.vertical.

axis?: "horizontal" | "vertical"

Either horizontal (the default, groups of child vertices are laid out in rows) or vertical (groups of child vertices are laid out in columns)

edgeFilter?: ((e) => boolean)

Optional filter for edges. If provided, this function will be used to filter the edges that identify links between vertices. All filtered edges are gathered

Type declaration

    • (e): boolean
    • Parameters

      • e: Edge

      Returns boolean

gatherUnattachedRoots?: boolean

If true root nodes that do not have children will be positioned adjacent to the last root node that does have children. When false (which is the default), unattached roots are spaced apart so that they do not overlap any child trees.

generateRouting?: boolean

Defaults to false. If true, the layout generates routing information for the channels between layers and edge nodes, and for edge routing.

getRootNode?: (() => AbstractEdgeTerminus)

Optional function you can provide that will dynamically be invoked to get the root node to use.

Type declaration

height?: number

Optional fixed height for the layout.

invert?: boolean

If true, the layout will be inverted in its perpendicular axis. For instance, if axis is "horizontal" and invert is true, the root nodes of the layout will be placed at the bottom of the layout, and their children will be placed above them.

locationFunction?: LocationFunction

Optional function that, given some vertex, can provide the x/y location of the vertex on the canvas

maxIterations?: number

Maximum number of iterations to run. Defaults to 24.

maxIterationsWithoutImprovement?: number

Number of iterations to try rearranging the graph without an improvement in legibility before accepting the current state. Defaults to 2.

padding?: PointXY

Optional padding to put around the elements.

placementStrategy?: "center" | "end" | "start" | "parent"

The strategy to use when placing vertices. Default is 'center', meaning every row is centered around the axis orthogonal to the axis in which the vertices are laid out.

respectEdgeDirection?: boolean

If true, the layout will take into account 'directed' edges, and attempt to place the source of any given edge in a higher layer than the edge's target. This flag also has the effect of positioning any nodes that act only as the source of one or more edges on the root layer of the layout.

It isn't always possible to place the source of some edge in a higher layer than the edge's target, due to the graph's topology, but this flag will ensure the layout makes every effort to do so.

rootNode?: any

Optional node to use as the root. If this is not provided the layout calculates the best candidate based upon incoming and outgoing edges for each vertex.

width?: number

Optional fixed width for the layout.