Skip to content

Commit a485c63

Browse files
authored
Merge pull request #485 from Justin-ZS/zisen/20703
doc(visualmap): add doc for seriesTargets
2 parents 9572d98 + 06a7e71 commit a485c63

4 files changed

Lines changed: 181 additions & 0 deletions

File tree

en/option/component/visual-map.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,55 @@ Specify visual mapping should be performed on which series, from which
325325
Can be a id or a list of ids.
326326
All series are used by default.
327327

328+
## seriesTargets(Array)
329+
330+
{{ use: partial-version(version = "6.0.1") }}
331+
332+
Specify multiple series with their corresponding dimension mappings. When `seriesTargets` is configured, `seriesIndex`, `seriesId`, and `dimension` will be ignored.
333+
334+
This option allows a single `visualMap` component to control different dimensions of multiple series simultaneously, which is particularly useful when working with datasets.
335+
336+
Each target object should contain the following properties:
337+
- `seriesIndex` or `seriesId`: Specify the series (choose one)
338+
- `dimension`: Specify the data dimension for that series
339+
340+
Example:
341+
```javascript
342+
option = {
343+
dataset: {
344+
source: [
345+
['product', 'sales', 'price', 'year'],
346+
['A', 100, 20, 2020],
347+
['B', 200, 30, 2021],
348+
['C', 150, 25, 2022]
349+
]
350+
},
351+
visualMap: {
352+
type: 'continuous',
353+
min: 0,
354+
max: 100,
355+
// Configure different series to use different dimensions
356+
seriesTargets: [
357+
{
358+
seriesIndex: 0,
359+
dimension: 1 // First series uses 'sales' dimension
360+
},
361+
{
362+
seriesIndex: 1,
363+
dimension: 2 // Second series uses 'price' dimension
364+
}
365+
],
366+
inRange: {
367+
color: ['#50a3ba', '#eac736', '#d94e5d']
368+
}
369+
},
370+
series: [
371+
{ type: 'bar' },
372+
{ type: 'line' }
373+
]
374+
};
375+
```
376+
328377
## hoverLink(boolean) = true
329378

330379
`hoverLink` enable highlight certain graphical elements of chart when mouse hovers on some place of `visualMap` component that is corresponding to those graphical elements by visual mapping.

en/tutorial/visual-map.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,46 @@ option = {
145145
};
146146
```
147147

148+
Example C (Using seriesTargets to map different dimensions for different series):
149+
150+
```javascript
151+
option = {
152+
dataset: {
153+
source: [
154+
['product', 'sales', 'price', 'year'],
155+
['A', 100, 20, 2020],
156+
['B', 200, 30, 2021],
157+
['C', 150, 25, 2022]
158+
]
159+
},
160+
visualMap: [
161+
{
162+
type: 'continuous',
163+
min: 0,
164+
max: 100,
165+
// seriesTargets allows specifying different mapping dimensions for different series
166+
// When seriesTargets is configured, dimension, seriesIndex, and seriesId are ignored
167+
seriesTargets: [
168+
{
169+
seriesIndex: 0,
170+
dimension: 1 // First series maps to 'sales' dimension
171+
},
172+
{
173+
seriesIndex: 1,
174+
dimension: 2 // Second series maps to 'price' dimension
175+
}
176+
],
177+
inRange: {
178+
color: ['#50a3ba', '#eac736', '#d94e5d']
179+
}
180+
},
181+
...
182+
],
183+
series: [
184+
{ type: 'bar' },
185+
{ type: 'line' }
186+
]
187+
};
188+
```
189+
148190
For more information, please refer to [visualMap.inRange](option.html#visualMap.inRange) and [visualMap.outOfRange](option.html#visualMap.outOfRange).

zh/option/component/visual-map.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,55 @@ chart.setOption(option); // option设置回 ${componentMainType}
295295
可以是一个 id 或者一个 id 数组。
296296
默认取所有系列。
297297

298+
## seriesTargets(Array)
299+
300+
{{ use: partial-version(version = "6.0.1") }}
301+
302+
指定多个系列及其对应的维度映射关系。当配置了 `seriesTargets` 时,`seriesIndex``seriesId``dimension` 将被忽略。
303+
304+
这个选项允许单个 `visualMap` 组件同时控制多个系列的不同维度,特别适用于使用 dataset 的场景。
305+
306+
每个目标对象应包含以下属性:
307+
- `seriesIndex``seriesId`:指定系列(二者选其一)
308+
- `dimension`:指定该系列使用的数据维度
309+
310+
示例:
311+
```javascript
312+
option = {
313+
dataset: {
314+
source: [
315+
['product', 'sales', 'price', 'year'],
316+
['A', 100, 20, 2020],
317+
['B', 200, 30, 2021],
318+
['C', 150, 25, 2022]
319+
]
320+
},
321+
visualMap: {
322+
type: 'continuous',
323+
min: 0,
324+
max: 100,
325+
// 配置不同系列使用不同维度
326+
seriesTargets: [
327+
{
328+
seriesIndex: 0,
329+
dimension: 1 // 第一个系列使用 'sales' 维度
330+
},
331+
{
332+
seriesIndex: 1,
333+
dimension: 2 // 第二个系列使用 'price' 维度
334+
}
335+
],
336+
inRange: {
337+
color: ['#50a3ba', '#eac736', '#d94e5d']
338+
}
339+
},
340+
series: [
341+
{ type: 'bar' },
342+
{ type: 'line' }
343+
]
344+
};
345+
```
346+
298347
## hoverLink(boolean) = true
299348

300349
打开 `hoverLink` 功能时,鼠标悬浮到 `visualMap` 组件上时,鼠标位置对应的数值 在 图表中对应的图形元素,会高亮。

zh/tutorial/visual-map.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,45 @@ option = {
146146
};
147147
```
148148

149+
例三(使用 seriesTargets 映射不同系列的不同维度):
150+
```javascript
151+
option = {
152+
dataset: {
153+
source: [
154+
['product', 'sales', 'price', 'year'],
155+
['A', 100, 20, 2020],
156+
['B', 200, 30, 2021],
157+
['C', 150, 25, 2022]
158+
]
159+
},
160+
visualMap: [
161+
{
162+
type: 'continuous',
163+
min: 0,
164+
max: 100,
165+
// 使用 seriesTargets 可以为不同系列指定不同的映射维度
166+
// 当配置 seriesTargets 后,dimension、seriesIndex、seriesId 将被忽略
167+
seriesTargets: [
168+
{
169+
seriesIndex: 0,
170+
dimension: 1 // 第一个系列映射 'sales' 维度
171+
},
172+
{
173+
seriesIndex: 1,
174+
dimension: 2 // 第二个系列映射 'price' 维度
175+
}
176+
],
177+
inRange: {
178+
color: ['#50a3ba', '#eac736', '#d94e5d']
179+
}
180+
},
181+
...
182+
],
183+
series: [
184+
{ type: 'bar' },
185+
{ type: 'line' }
186+
]
187+
};
188+
```
189+
149190
更多详情,参见 [visualMap.inRange](option.html#visualMap.inRange)[visualMap.outOfRange](option.html#visualMap.outOfRange)

0 commit comments

Comments
 (0)