Skip to main content

Home > @jsplumbtoolkit/layout-hierarchy > HierarchyLayoutParameters

HierarchyLayoutParameters interface

Optional parameters for a Hierarchy layout


export interface HierarchyLayoutParameters extends AbsoluteBackedLayoutParameters 

Extends: AbsoluteBackedLayoutParameters


axis?HierarchyLayoutAxis(Optional) Either horizontal (the default, groups of child vertices are laid out in rows) or vertical (groups of child vertices are laid out in columns)
edgeNodeSize?number(Optional) Optional size - in the main axis - to use for edge nodes, which are dummy nodes (not visible) that are inserted on a layer to allow an edge to pass through to a layer below.
gatherUnattachedRoots?boolean(Optional) 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.
invert?boolean(Optional) 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.
maxIterations?number(Optional) Maximum number of iterations to run. Defaults to 24.
maxIterationsWithoutImprovement?number(Optional) Number of iterations to try rearranging the graph without an improvement in legibility before accepting the current state. Defaults to 2.
placementStrategy?PlacementStageStrategy(Optional) 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.

(Optional) 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) 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.