Skip to content

Commit 85778fa

Browse files
committed
improve typings for legend action parameters (apache/echarts#21025)
1 parent 0cfc08f commit 85778fa

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

en/api/action.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,9 @@ dispatchAction({
178178

179179
// The following parameters are supported since v5.6.0
180180
// the id of target legend component
181-
legendId: string,
181+
legendId?: string | string[],
182182
// the index of target legend component
183-
legendIndex: number,
184-
// the name of target legend component
185-
legendName: string
183+
legendIndex?: number | number[]
186184
})
187185
```
188186

@@ -197,23 +195,27 @@ dispatchAction({
197195

198196
// The following parameters are supported since v5.6.0
199197
// the id of target legend component
200-
legendId: string,
198+
legendId?: string | string[],
201199
// the index of target legend component
202-
legendIndex: number,
203-
// the name of target legend component
204-
legendName: string
200+
legendIndex?: number | number[]
205201
})
206202
```
207203

208204
**EVENT:** [legendinverseselect](~events.legendinverseselect)
209205

210206
### legendScroll(Action)
211207
Control the scrolling of legend. It works when [legend.type](option.html#legend.type) is `'scroll'`.
208+
212209
```ts
213210
dispatchAction({
214211
type: 'legendScroll',
212+
// the index of the legend item to scroll to
215213
scrollDataIndex: number,
216-
legendId: string
214+
215+
// the id of target legend component
216+
legendId?: string | string[],
217+
// the index of target legend component
218+
legendIndex?: number | number[]
217219
})
218220
```
219221

zh/api/action.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,9 @@ dispatchAction({
178178

179179
// 下列参数自 v5.6.0 起开始支持
180180
// 图例组件ID
181-
legendId: string,
181+
legendId?: string | string[],
182182
// 图例组件索引
183-
legendIndex: number,
184-
// 图例组件名称
185-
legendName: string
183+
legendIndex?: number | number[]
186184
})
187185
```
188186

@@ -197,23 +195,27 @@ dispatchAction({
197195

198196
// 下列参数自 v5.6.0 起开始支持
199197
// 图例组件ID
200-
legendId: string,
198+
legendId?: string | string[],
201199
// 图例组件索引
202-
legendIndex: number,
203-
// 图例组件名称
204-
legendName: string
200+
legendIndex?: number | number[]
205201
})
206202
```
207203

208204
**EVENT:** [legendinverseselect](~events.legendinverseselect)
209205

210206
### legendScroll(Action)
211207
控制图例的滚动。当 [legend.type](option.html#legend.type)`'scroll'` 时有效。
208+
212209
```ts
213210
dispatchAction({
214211
type: 'legendScroll',
212+
// 要滚动到的目标图例项索引
215213
scrollDataIndex: number,
216-
legendId: string
214+
215+
// 图例组件ID
216+
legendId?: string | string[],
217+
// 图例组件索引
218+
legendIndex?: number | number[]
217219
})
218220
```
219221

0 commit comments

Comments
 (0)