g6/examples/tree/indented/API.en.md
2019-11-14 16:26:29 +08:00

2.1 KiB
Raw Blame History

title
API

direction

Type: String
可选值: 'LR' | 'RL' | 'H'
Default: 'LR'
Required: false
Explanation: The direction of layout.

  • LR —— Root is on the left, layout from the left to the right(left image below)
  • RL —— Root is on the right, layout from the right to the left(center image below)
  • H —— Root is on the middle, layout in horizontal symmetry(right image below)

image.png          image.png           image.png

LeftLR。CenterRL。RightH。

indent

Type: Number
Default: 20
Required: false
Explanation: Colunm separation

getWidth

Type: Number | Function
Example:

(d) => {
  // d is a node
  if (d.id === 'testId') return 50
  return 100;
}

Required: false
Explanation: The width of node

getHeight

Type: Number | Function
Example:

(d) => {
  // d is a node
  if (d.id === 'testId') return 50
  return 100;
}

Required: false
Explanation: The height of node

getSide

Type: Function
Example:

(d) => {
  // d is a node
  if (d.id === 'testId') return 'left'
  return 'right';
}

Required: false
Explanation: The callback function of node position(left or right of root node). Only affects the nodes which are connected to the root node directly. And the descendant nodes will be placed according to it.