Skip to content

Commit d48eb31

Browse files
authored
docs: optimize api docs (#6813)
* docs: optimize graph options docs * docs: add element options docs * docs: optimize element options docs * docs: upload layout/plugin/transform docs * docs: add behavior docs * docs: 侧边栏更新 * fix: comment * fix: update
1 parent 36c7024 commit d48eb31

File tree

176 files changed

+12198
-852
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

176 files changed

+12198
-852
lines changed

packages/site/.dumirc.ts

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ export default defineConfig({
5959
},
6060
navs: [
6161
{
62-
slug: 'docs/manual/introduction',
62+
slug: 'docs/manual',
6363
title: {
6464
zh: '文档',
6565
en: 'Docs',
6666
},
6767
},
6868
{
69-
slug: 'docs/api/graph/option',
69+
slug: 'docs/api',
7070
title: {
7171
zh: 'API',
7272
en: 'API',
@@ -159,13 +159,15 @@ export default defineConfig({
159159
zh: 'Graph - 图',
160160
en: 'Graph',
161161
},
162+
order: 1,
162163
},
163164
{
164165
slug: 'api/elements',
165166
title: {
166167
zh: 'Element - 元素',
167168
en: 'Element',
168169
},
170+
order: 2,
169171
},
170172
{
171173
slug: 'api/elements/nodes',
@@ -194,41 +196,31 @@ export default defineConfig({
194196
zh: 'Layout - 布局',
195197
en: 'Layout',
196198
},
199+
order: 3,
197200
},
198201
{
199202
slug: 'api/behaviors',
200203
title: {
201204
zh: 'Behavior - 交互',
202205
en: 'Behavior',
203206
},
207+
order: 4,
204208
},
205209
{
206210
slug: 'api/plugins',
207211
title: {
208212
zh: 'Plugin - 插件',
209213
en: 'Plugin',
210214
},
215+
order: 5,
211216
},
212217
{
213218
slug: 'api/transforms',
214219
title: {
215220
zh: 'Transform - 数据处理',
216221
en: 'Transform',
217222
},
218-
},
219-
{
220-
slug: 'api/extension',
221-
title: {
222-
zh: 'Extension - 扩展',
223-
en: 'Extension',
224-
},
225-
},
226-
{
227-
slug: 'api/reference',
228-
title: {
229-
zh: 'Export - 导出',
230-
en: 'Export',
231-
},
223+
order: 6,
232224
},
233225
],
234226
examples: [
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
---
2+
title: AutoAdaptLabel
3+
---
4+
5+
## Options
6+
7+
### <Badge type="success">Required</Badge> type
8+
9+
> _`auto-adapt-label`_
10+
11+
Behavior type
12+
13+
### enable
14+
15+
> _boolean \| ((event:_ _IGraphLifeCycleEvent \| IAnimateEvent \| IElementLifeCycleEvent \| IViewportEvent \| IPointerEvent \| IWheelEvent \| IKeyboardEvent \| IDragEvent) => boolean)_ **Default:** ``
16+
17+
Whether to enable
18+
19+
### padding
20+
21+
> _number \| number[]_ **Default:** `0`
22+
23+
Set the padding of the label to determine whether the label overlaps to avoid the label being displayed too densely
24+
25+
### sort
26+
27+
> _(elementA:_ _NodeData \| EdgeData \| ComboData, elementB:_ _NodeData \| EdgeData \| ComboData) => -1 \| 0 \| 1_
28+
29+
Sort elements by their importance in descending order; elements with higher importance have higher label display priority; usually combo > node > edge
30+
31+
### sortCombo
32+
33+
> _(comboA:_ [ComboData](/api/graph/option#combodata)_, comboB:_ [ComboData](/api/graph/option#combodata)_) => -1 \| 0 \| 1_
34+
35+
Sort combos by importance in descending order; combos with higher importance have higher label display priority. By default, they are sorted according to the data. It should be noted that if `sort` is set, `sortCombo` will not take effect
36+
37+
### sortEdge
38+
39+
> _(edgeA:_ [EdgeData](/api/graph/option#edgedata)_, edgeB:_ [EdgeData](/api/graph/option#edgedata)_) => -1 \| 0 \| 1_
40+
41+
Sort edges by importance in descending order; edges with higher importance have higher label display priority. By default, they are sorted according to the data. It should be noted that if `sort` is set, `sortEdge` will not take effect
42+
43+
### sortNode
44+
45+
Sort nodes by importance in descending order; nodes with higher importance have higher label display priority. Several centrality algorithms are built in, and custom sorting functions can also be defined. It should be noted that if `sort` is set, `sortNode` will not take effect
46+
47+
### throttle
48+
49+
> _number_ **Default:** `32`
50+
51+
Throttle time
52+
53+
## API
54+
55+
### AutoAdaptLabel.destroy()
56+
57+
```typescript
58+
destroy(): void;
59+
```
60+
61+
### AutoAdaptLabel.update(options)
62+
63+
```typescript
64+
update(options: Partial<AutoAdaptLabelOptions>): void;
65+
```
66+
67+
<details><summary>View Parameters</summary>
68+
69+
<table><thead><tr><th>
70+
71+
Parameter
72+
73+
</th><th>
74+
75+
Type
76+
77+
</th><th>
78+
79+
Description
80+
81+
</th></tr></thead>
82+
<tbody><tr><td>
83+
84+
options
85+
86+
</td><td>
87+
88+
Partial&lt;[AutoAdaptLabelOptions](#options)>
89+
90+
</td><td>
91+
92+
</td></tr>
93+
</tbody></table>
94+
95+
**Returns**:
96+
97+
- **Type:** void
98+
99+
</details>
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
title: AutoAdaptLabel 标签自适应显示
3+
---
4+
5+
> 如需深入了解交互的使用,请参阅 [API 文档 - 图配置项 - behaviors](/api/graph/option#behaviors) 章节。此章节将介绍完整的配置参数、类型定义以及应用示例。
6+
7+
标签自适应显示是一种动态标签管理策略,旨在根据当前可视范围的空间分配、节点重要性等因素,智能调整哪些标签应显示或隐藏。通过对可视区域的实时分析,确保用户在不同的交互场景下获得最相关最清晰的信息展示,同时避免视觉过载和信息冗余。
8+
9+
## 配置项
10+
11+
### <Badge type="success">Required</Badge> type
12+
13+
> _`auto-adapt-label` \| string_
14+
15+
此插件已内置,你可以通过 `type: 'auto-adapt-label'` 来使用它。
16+
17+
### enable
18+
19+
> _boolean \| ((event:_ _IGraphLifeCycleEvent \| IAnimateEvent \| IElementLifeCycleEvent \| IViewportEvent \| IPointerEvent \| IWheelEvent \| IKeyboardEvent \| IDragEvent) => boolean)_ **Default:** ``
20+
21+
是否启用
22+
23+
### padding
24+
25+
> _number \| number[]_ **Default:** `0`
26+
27+
设置标签的内边距,用于判断标签是否重叠,以避免标签显示过于密集
28+
29+
### sort
30+
31+
> _(elementA:_ _NodeData \| EdgeData \| ComboData, elementB:_ _NodeData \| EdgeData \| ComboData) => -1 \| 0 \| 1_
32+
33+
根据元素的重要性从高到低排序,重要性越高的元素其标签显示优先级越高。一般情况下 combo > node > edge
34+
35+
### sortCombo
36+
37+
> _(comboA:_ [ComboData](/api/graph/option#combodata)_, comboB:_ [ComboData](/api/graph/option#combodata)_) => -1 \| 0 \| 1_
38+
39+
根据群组的重要性从高到低排序,重要性越高的群组其标签显示优先级越高。默认按照数据先后进行排序。需要注意,如果设置了 `sort`,则 `sortCombo` 不会生效
40+
41+
### sortEdge
42+
43+
> _(edgeA:_ [EdgeData](/api/graph/option#edgedata)_, edgeB:_ [EdgeData](/api/graph/option#edgedata)_) => -1 \| 0 \| 1_
44+
45+
根据边的重要性从高到低排序,重要性越高的边其标签显示优先级越高。默认按照数据先后进行排序。需要注意,如果设置了 `sort`,则 `sortEdge` 不会生效
46+
47+
### sortNode
48+
49+
> _[NodeCentralityOptions](#nodecentralityoptions) \| ((nodeA: [NodeData](/api/graph/option#nodedata), nodeB: [NodeData](/api/graph/option#nodedata)) => -1 \| 0 \| 1)_ **Default:** `type: 'degree'`
50+
51+
根据节点的重要性从高到低排序,重要性越高的节点其标签显示优先级越高。内置几种中心性算法,也可以自定义排序函数。需要注意,如果设置了 `sort`,则 `sortNode` 不会生效
52+
53+
#### NodeCentralityOptions
54+
55+
```typescript
56+
type NodeCentralityOptions =
57+
| { type: 'degree'; direction?: 'in' | 'out' | 'both' }
58+
| { type: 'betweenness'; directed?: boolean; weightPropertyName?: string }
59+
| { type: 'closeness'; directed?: boolean; weightPropertyName?: string }
60+
| { type: 'eigenvector'; directed?: boolean }
61+
| { type: 'pagerank'; epsilon?: number; linkProb?: number };
62+
```
63+
64+
### throttle
65+
66+
> _number_ **Default:** `32`
67+
68+
节流时间
69+
70+
## API
71+
72+
### AutoAdaptLabel.destroy()
73+
74+
```typescript
75+
destroy(): void;
76+
```
77+
78+
### AutoAdaptLabel.update(options)
79+
80+
```typescript
81+
update(options: Partial<AutoAdaptLabelOptions>): void;
82+
```
83+
84+
| 参数 | 类型 | 描述 | 默认值 | 必选 |
85+
| ------- | ----------------------------------------- | ------ | ------ | ---- |
86+
| options | Partial<[AutoAdaptLabelOptions](#配置项)> | 配置项 | - ||
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
title: BrushSelect
3+
---
4+
5+
<embed src="@/common/api/behaviors/brush-select.md"></embed>
6+
7+
## Options
8+
9+
### key
10+
11+
> _string_
12+
13+
Behavior key, that is, the unique identifier
14+
15+
Used to identify the behavior for further operations
16+
17+
```typescript
18+
// Update behavior options
19+
graph.updateBehavior({key: 'key', ...});
20+
```
21+
22+
### <Badge type="success">Required</Badge> type
23+
24+
> _string_
25+
26+
Behavior type
27+
28+
### animation
29+
30+
> _boolean_ **Default:** `false`
31+
32+
Whether to enable animation.
33+
34+
### enable
35+
36+
> _boolean \| ((event:_ [Event](/manual/graph-api/event#事件对象属性)_) => boolean)_ **Default:** `true`
37+
38+
Whether to enable Brush select element function.
39+
40+
### enableElements
41+
42+
> _'node' \| 'edge' \| 'combo'\_\_[]_ **Default:** `['node', 'combo', 'edge']`
43+
44+
Enable Elements type.
45+
46+
### immediately
47+
48+
> _boolean_ **Default:** `false`
49+
50+
Whether to brush select immediately, only valid when the brush select mode is `default`
51+
52+
### mode
53+
54+
> _'union' \| 'intersect' \| 'diff' \| 'default'_ **Default:** `'default'`
55+
56+
Brush select mode
57+
58+
- `'union'`: Keep the current state of the selected elements and add the specified state.
59+
60+
- `'intersect'`: If the selected elements already have the specified state, keep it; otherwise, clearBrush it.
61+
62+
- `'diff'`: Perform a negation operation on the specified state of the selected elements.
63+
64+
- `'default'`: Clear the current state of the selected elements and add the specified state.
65+
66+
### onSelect
67+
68+
> _(states:_ _Record**&lt;**string\_\_,_ _string_ _\|_ _string\_\_[]>) =>_ _Record**&lt;**string\_\_,_ _string_ _\|_ _string\_\_[]>_
69+
70+
Callback when brush select elements.
71+
72+
### state
73+
74+
> _string_ **Default:** `'selected'`
75+
76+
The state to switch to when selected.
77+
78+
### style
79+
80+
> _RectStyleProps_
81+
82+
Timely screening.
83+
84+
### trigger
85+
86+
> _string[]_ **Default:** `['shift']`
87+
88+
Press this shortcut key to apply brush select with mouse click.
89+
90+
Note that setting `trigger` to `['drag']` will cause the `drag-canvas` behavior to fail. The two cannot be configured at the same time.
91+
92+
## API

0 commit comments

Comments
 (0)