DEMOS
DOCS
FEATURES
DOWNLOAD
PURCHASE
CONTACT
BLOG
Show:

Layouts.Hierarchical Class

Provides a hierarchical tree layout, oriented either horizontally or vertically.

Constructor

Layouts.Hierarchical

(
  • params
  • [compress
)

Parameters:

  • params Object

    Constructor parameters

    • [orientation="horizontal"] String optional

      Orientation of the layout. Valid values are "vertical" and "horizontal".

    • [padding] Number optional

      Array of padding values for x and y axes. Default is [60, 60].

    • [spacing="auto"] String optional

      Indicates how the nodes should be spaced in the orthogonal axis to the layout. Valid values are "auto" (the default), and "compress". Auto is the original spacing mechanism, in which all nodes in a certain level of the hierarchy are aligned. "compress" disregards the size of the other elements in each level and just spaces nodes according to the padding values.

    • [invert=false] Boolean optional

      If true, the layout will be inverted, ie. the root node will be at the bottom for horizontal layouts, and to the right for vertical layouts.

    • [align="center"] String optional

      Valid values are "center", "start" and "end". This instructs the layout where to place child elements in relation to their parents. By default the layout centers child elements relative to their parents.

  • [compress Boolean

    = false] DEPRECATED - use spacing:"compress". If true, the layout will use a regular spacing between each node and its parent. Otherwise the layout pushes each node down by the maximum size of some element in that level of the hierarchy. For complex hierarchies in which any given node may have children, that is better. But for simple hierarchies, setting compress can give good results.

Item Index

Methods

Methods

getHierarchy

() Array

Gets the computed hierarchy. This is returned as an array of objects, one for each level, inside which there is a nodes array.

Returns:

Array: