apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.7k stars 19.62k forks source link

Unable to apply a single visual map configuration to multiple series in charts when using the dataset approach. #20347

Open sanganasrikanth9618 opened 2 months ago

sanganasrikanth9618 commented 2 months ago

Version

5.5.1

Link to Minimal Reproduction

https://codepen.io/Srikanth-Sangana/pen/vYqwaxK

Steps to Reproduce

Created a chart using the options below, following the dataset approach:

var dom = document.getElementById('chart-container'); var myChart = echarts.init(dom, null, { renderer: 'canvas', useDirtyRect: false }); var app = {};

var option; option = { textStyle: { fontFamily: 'OpenSans-Regular' }, grid: { left: 74, right: 6, bottom: 58, top: 50, containLabel: true }, visualMap: { type: 'piecewise', pieces: [ { gt: 0, lte: 2000, color: '#93CE07' }, { gt: 2001, lte: 2500, color: '#FBDB0F' }, { gt: 2501, color: '#FD0100' } ], outOfRange: { color: ' #808080' }, seriesIndex: [0, 1] }, yAxis: { name: 'Measures', type: 'value', min: 0, max: 4000, interval: 250 }, series: [ { type: 'line', xAxisIndex: 0, yAxisIndex: 0, name: 'series_1', label: { show: true }, }, { type: 'line', xAxisIndex: 0, yAxisIndex: 0, name: 'series_2', label: { show: true }, } ], dataset: [ { dimensions: [ 'chainname_desc', 'series_1', 'series_2' ], source: [ { chain: 'NCC2456', series_1: 1020, series_2: 1150, chainname_desc: 'CHAIN ONE' }, { chain: 'NCC3569', series_1: 2700, series_2: 2300, chainname_desc: 'CHAIN TWO' }, { chain: 'NCC7845', series_1: 3500, series_2: 3100, chainname_desc: 'CHAIN THREE' } ] } ], legend: { type: 'scroll', show: true, data: ['series_1', 'series_2'], bottom: 0, left: 'center', width: 1130, }, xAxis: { data: ['CHAIN ONE', 'CHAIN TWO', 'CHAIN THREE'], name: 'Chain', type: 'category', } };

if (option && typeof option === 'object') { myChart.setOption(option); }

window.addEventListener('resize', myChart.resize);

Current Behavior

Current

Currently, the visual map is not applied to all series, even though the seriesIndex includes all the series in the array.

Expected Behavior

The single visual map configuration should apply to multiple series in the dataset approach that we followed.

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

helgasoft commented 2 months ago

agree, visualMap works fine with series-line.data, but has a bug with dataset - Demo. This is a variation(duplicate) of a known bug #19270. In the example above dimension:1 is equivalent to the second row of dataset.