Skip to content

pivotick v3.0.0


pivotick / LayoutOptions / TreeLayoutOptions

Interface: TreeLayoutOptions ​

Defined in: interfaces/LayoutOptions.ts:20

Extends ​

Properties ​

depthKey? ​

optional depthKey: string

Defined in: interfaces/LayoutOptions.ts:57

Name of the node.data key holding the row the node should sit on, counting from 0 at the shallowest root.

Leave undefined — the default — and a node sits one row below its parent. Name a key and each node that carries it is pushed down to the row it asks for, the gap filled with empty rows. This is how the roots of a multi-tree graph are put on different rows: give one of them a depth of 2 and its whole tree starts there.

A row can only ever push a node further down: a tidy tree cannot place a child above its parent, so a depth that is not below the parent's is clamped to parent + 1. Empty rows take up real space, so a large depth on a shallow graph squeezes every row — levelSpacing is the way back out.

Default ​

ts
undefined

horizontal? ​

optional horizontal: boolean

Defined in: interfaces/LayoutOptions.ts:72

Should the nodes be placed horizontally rather than vertically

Default ​

ts
false

levelSpacing? ​

optional levelSpacing: number

Defined in: interfaces/LayoutOptions.ts:98

Multiplies the distance between consecutive levels — the depth axis of the tree, or the gap between rings in radial mode. At 1 the tree is scaled to fill the canvas.

Default ​

ts
1

parentKey? ​

optional parentKey: string

Defined in: interfaces/LayoutOptions.ts:41

Name of the node.data key holding the id of the node's parent in the hierarchy.

Leave undefined — the default — and parenthood is derived from the edges, as it always was. Name a key and each node that carries it is attached to the node it names, whether or not an edge joins them; a branch declared without an edge is drawn without a line. A key naming a node that is not being laid out, or one that would close a cycle, is dropped for that node, which falls back to the edges.

Ignored while rootId is set: pinning a root re-derives every parent from the edges, which is what makes the root picker able to re-hang a declared tree.

Default ​

ts
undefined

radial? ​

optional radial: boolean

Defined in: interfaces/LayoutOptions.ts:67

Should the nodes be placed radially instead of vertically

Default ​

ts
false

radialGap ​

radialGap: number

Defined in: interfaces/LayoutOptions.ts:82

The grap between each layers used in the radial mode

Default ​

ts
750

rootId? ​

optional rootId: string

Defined in: interfaces/LayoutOptions.ts:27

Specify the ID of the node to be used as the root of the tree. Keep undefined to let rooIdAlgorithmFinder to select it.

Default ​

ts
undefined

rootIdAlgorithmFinder ​

rootIdAlgorithmFinder: TreeLayoutAlgorithm

Defined in: interfaces/LayoutOptions.ts:77

The algorithm to use to find the root of the tree

Default ​

ts
'MaxReachability'

siblingSpacing? ​

optional siblingSpacing: number

Defined in: interfaces/LayoutOptions.ts:104

Multiplies the distance between nodes within a level — the breadth axis. Ignored in radial mode, where a level always spans the full circle.

Default ​

ts
1

spacing? ​

optional spacing: "manual" | "auto"

Defined in: interfaces/LayoutOptions.ts:92

Whether the two spacing multipliers tune themselves from the size of the nodes and the shape of the tree, or stay exactly where they are put.

'auto' is the default — except for a tree that sets levelSpacing or siblingSpacing explicitly, which is taken as having made up its mind. Turning either multiplier by hand afterwards also leaves auto, permanently.

Default ​

ts
'auto'

strength? ​

optional strength: number

Defined in: interfaces/LayoutOptions.ts:62

The strength of the force keeping the nodes placed to form a tree in place

Default ​

ts
0.1

type ​

type: "tree"

Defined in: interfaces/LayoutOptions.ts:21

Default ​

ts
'force'

Overrides ​

BaseLayoutOptions.type