Skip to content

Commit

Permalink
docs: Indented layoutCfg.indent support function (#3109)
Browse files Browse the repository at this point in the history
* docs: Indented layoutCfg.indent support function

We can set node's horizontal offset dynamically with function,
which allow user to create custom layout.

Closes #3081

* docs: Indented layoutCfg.indent support function

Co-authored-by: powellpeng <powellpeng@tencent.com>
  • Loading branch information
2 people authored and Yanyan-Wang committed Jun 13, 2022
1 parent 8e97f92 commit ca96b84
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
12 changes: 11 additions & 1 deletion packages/site/docs/api/treeGraphLayout/indented.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,17 @@ Indented layout represents the hierarchy by indent between them. Each node will
### layoutCfg.indent

**Type**: Number<br />**Default**: 20<br />**Required**: false<br />**Description**: Colunm separation
**Type**: Number | Function<br />**Default**: 20<br />**Example**

```javascript
(d) => {
// d is a node
if (d.parent?.id === 'testId') return d.parent.x + 50;
return 100;
};
```
**Required**: false<br />**Description**: When the type is Number, the colunm separation is a fixed value; When the type is Function, the distance between the node and the root node is the returned value of the function.
### layoutCfg.getWidth
Expand Down
12 changes: 11 additions & 1 deletion packages/site/docs/api/treeGraphLayout/indented.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,17 @@ order: 3
### layoutCfg.indent

**类型**:Number<br />**默认值**:20<br />**是否必须**:false<br />**说明**:列间间距
**类型**:Number | Function<br />**默认值**:20<br />**示例**

```javascript
(d) => {
// d 是一个节点
if (d.parent?.id === 'testId') return d.parent.x + 50;
return 100;
};
```
**是否必须**:false<br />**说明**:类型为Number时,列间间距是固定值;类型为Function时,节点与根结点的间距是函数返回值。
### layoutCfg.getWidth
Expand Down

0 comments on commit ca96b84

Please sign in to comment.