Skip to content

Commit 8e844b5

Browse files
authored
Merge pull request #3507 from VisActor/docs/restorPosition
docs: add docs for `restorePosition`
2 parents 486f96f + 5a691ad commit 8e844b5

File tree

2 files changed

+40
-12
lines changed

2 files changed

+40
-12
lines changed

docs/assets/option/en/component/label.md

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,19 @@ Overlap avoidance strategy for labels, providing 4 avoidance strategies, respect
169169
```ts
170170
export type PositionStrategy = {
171171
/**
172-
* 可选位置策略。
173-
* 若默认位置没有足够的空间放置标签,则考虑 position 内的备选位置。
172+
* Optional position strategy.
173+
* If the default position does not have enough space to place the label, consider the alternative positions within the position.
174174
*/
175175
type: 'position';
176-
/** position 根据图表类型支持不同支持不同的位置配置 **/
176+
/** position supports different configurations depending on the chart type **/
177177
position?: Functional<LabelPosition[]>;
178+
/**
179+
* When the alternative positions in position still cannot accommodate the label, whether the label is returned to its original position.
180+
* The default is true, if false, the label will be placed in the last position of the position array.
181+
* @since 1.12.15
182+
* @default true
183+
*/
184+
restorePosition?: boolean;
178185
};
179186
```
180187

@@ -183,12 +190,19 @@ Overlap avoidance strategy for labels, providing 4 avoidance strategies, respect
183190
```ts
184191
export type BoundStrategy = {
185192
/**
186-
* 标签配置在图形内部时使用。
187-
* 当图形大小不足以放下标签,则考虑 position 内的备选位置。
193+
* Used when configuring labels inside a graphic.
194+
* If the graphic size is insufficient to accommodate the label, consider alternative positions within the position.
188195
*/
189196
type: 'bound';
190-
/** position 根据图表类型支持不同支持不同的位置配置 **/
197+
/** position supports different configurations depending on the chart type **/
191198
position?: Functional<LabelPosition[]>;
199+
/**
200+
* When the alternative positions in position still cannot accommodate the label, whether the label is returned to its original position.
201+
* The default is true, if false, the label will be placed in the last position of the position array.
202+
* @since 1.12.15
203+
* @default true
204+
*/
205+
restorePosition?: boolean;
192206
};
193207
```
194208

@@ -197,12 +211,12 @@ Overlap avoidance strategy for labels, providing 4 avoidance strategies, respect
197211
```ts
198212
export type MoveYStrategy = {
199213
/**
200-
* y 方向散开策略。
201-
* 若默认位置没有足够的空间放置标签,则根据 offset 在 y 方向上寻找位置。
214+
* Y-direction dispersion strategy.
215+
* If the default position does not have enough space to place the label, find a position in the y-direction based on the offset.
202216
*/
203217
type: 'moveY';
204218
/**
205-
* y 方向上的尝试的位置偏移量,可配置为函数。
219+
* The position offset in the y-direction can be configured as a function.
206220
*/
207221
offset: Functional<number[]>; // number | (data: any) => number[];
208222
};
@@ -213,12 +227,12 @@ Overlap avoidance strategy for labels, providing 4 avoidance strategies, respect
213227
```ts
214228
export type MoveYStrategy = {
215229
/**
216-
* x 方向散开策略。
217-
* 若默认位置没有足够的空间放置标签,则根据 offset 在 x 方向上寻找位置。
230+
* X-direction dispersion strategy.
231+
* If the default position does not have enough space to place the label, find a position in the x-direction based on the offset.
218232
*/
219233
type: 'moveX';
220234
/**
221-
* x 方向上的尝试的位置偏移量,可配置为函数。
235+
* The position offset in the x-direction can be configured as a function.
222236
*/
223237
offset: Functional<number[]>; // number | (data: any) => number[];
224238
};

docs/assets/option/zh/component/label.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,13 @@ hover 状态样式配置。
173173
type: 'position';
174174
/** position 根据图表类型支持不同支持不同的位置配置 **/
175175
position?: Functional<LabelPosition[]>;
176+
/**
177+
* 当 position 内的备选位置依然无法放下标签时,标签是否放回原位。
178+
* 默认为 true,若为 false,则标签会被放在 position 数组的最后一个位置。
179+
* @since 1.12.15
180+
* @default true
181+
*/
182+
restorePosition?: boolean;
176183
};
177184
```
178185

@@ -187,6 +194,13 @@ hover 状态样式配置。
187194
type: 'bound';
188195
/** position 根据图表类型支持不同支持不同的位置配置 **/
189196
position?: Functional<LabelPosition[]>;
197+
/**
198+
* 当 position 内的备选位置依然无法放下标签时,标签是否放回原位。
199+
* 默认为 true,若为 false,则标签会被放在 position 数组的最后一个位置。
200+
* @since 1.12.15
201+
* @default true
202+
*/
203+
restorePosition?: boolean;
190204
};
191205
```
192206

0 commit comments

Comments
 (0)