Skip to content

Interface: GraphTraceTree ​

Options of the tree arrangements: 'tree', 'radial' and 'dendrogram'. The tree is the one parents gives; with link.source / link.target, each node hangs from the first node that links to it, starting at the nodes without incoming links, and the links left over are drawn in the link.secondary style. Lengths are layout units: CSS px at the size the graph is laid out for, before it is fitted to the plot area.

Properties ​

PropertyTypeDefault valueDescription
collapsed?DataColumnundefinedThe nodes whose subtrees are folded away, as node indices; with tree input (parents), ids (ids, else labels) work too. The nodes below a collapsed node are not drawn and take no room, and the node gets a ring that says it holds something. A click on a node that has children adds it to this list or removes it (see collapsible).
collapsible?booleantrueA click on a node that has children folds its subtree away, and a second click unfolds it. The chart then updates tree.collapsed itself and emits restyle, as for any change made on the chart, and the tree moves to its new shape (at once without motion: prefers-reduced-motion, config.a11y.reducedMotion).
links?"straight" | "curved" | "elbow"undefinedThe shape of the tree's links: straight lines, S-shaped curves ('curved') or right angles ('elbow'; in a 'radial' tree, along the rings). Default: 'curved', and 'elbow' for a dendrogram, which has no curves.
nodesep?numberundefinedRoom between two neighbours on a level (on a ring for 'radial'; between two leaves for 'dendrogram'), on top of their sizes and of their labels, in layout units. Default: 10, or 20 for box nodes. Minimum: 0
orientation?"TB" | "BT" | "LR" | "RL"undefined'tree' and 'dendrogram': where the root is and which way the tree grows: 'TB' (root at the top), 'BT', 'LR' (root on the left) or 'RL'. Default: 'LR' for a tree, whose labels then read along the levels, and 'TB' for a dendrogram, whose heights are then on the y axis.
ranksep?numberundefinedRoom between two levels (two rings for 'radial'), in layout units; a dendrogram without node.value has levels this far apart. Default: 50, plus room for the labels that are drawn between the levels. Minimum: 0
sector?GraphTraceTreeSectorundefined'radial': the part of the circle the tree fans out over.
sort?"input" | "value" | "size""input"The order of the children of a node: as given ('input'), by the number of nodes below them ('size') or by node.value.
sortorder?"descending" | "ascending""descending"Which way sort: 'size' and 'value' order: largest first, or smallest first.
subtreesep?numberundefined'tree' and 'radial': room between two neighbours that have different parents. Default: nodesep. Minimum: 0

Released under the MIT License.