You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2022/09/20 13:54:56 UTC

[GitHub] [echarts] hongdeyuan commented on issue #17577: [Bug] dispatchAction select with dataIndex, but some nodes that are not in the array but have the same name as a node in the array are selected

hongdeyuan commented on issue #17577:
URL: https://github.com/apache/echarts/issues/17577#issuecomment-1252391224

   > I think this is not a bug. In Apache ECharts, series/data with the same `name` means intentionally set them to be the same group. For example, if you [set the name to be the same for a pie series](https://echarts.apache.org/examples/en/editor.html?c=pie-simple&code=PYBwLglsB2AEC8sDeAoWtJgDYFMBcya6GOAHmAQOQBKOAZjgE5OzB2wCGsA6jgEYBnCGByUANEXQCArnxHkqAMQ4BrHLAAiHMB3GTYuOhViUAxjmgjGlIgF8J6MMGBZIIAqmIZGEAOa-mKmEcAFsbdHsiXADoABMPfWAfC2NKADcmSFMOLD0vQ1SC8NhIqSYIHAECAG19Ty9YaA4Q_BMAQVNzAQFYRUZgMIcGsABPEFbKEAq8hsYOWIhpKpMAVgAGAFIZr1jtDhr9LyRYNJzpVoBGNYAWAA4xRuaJjQhmUzBKEqGG5BOz1oA7ABmFYPJotKgvN4fL6HYjHU5Yc4EFa3NZgp6Q144d6fUo_X6I5GwO7XDEQkwAVWgUDgbViAjx3waCP-BCBa3RjwplAAahBYjhgLB6YySnCALrM9ChEAACw4QmW9R-wRCAGVRrgEgTiAIFbFgAB3ABCSMYBCu0oa-vmxoA8nQ6AIcGAABoEdFwry2w1GgDCLiSVEYvj4HAAFFzow81gA6FYASmKP1scLTXgzsAlKFsAG4gA), the data with the same name share the same color and they all dispears on legend toggling. So I think `disapactAction` should work similarly and this is by design.
   
   I have another similar question about the same 'name'
   
   **As follows**
       When there are two connect "group" line charts, I only click to close the legend of one line chart with the same name, and the legend of the other line chart is also closed;
       A example :https://codepen.io/hongdeyuan/pen/yLjXPXv
       As shown in the picture: 
   ![image](https://user-images.githubusercontent.com/37143703/191270503-32036c9a-2705-4dbb-90ad-1743f5a04b3d.png)
   
       **Whether it is possible to connect only the hover event, but not the click event** 
       Therefore, I think whether Apache ECharts can provide a "group" for each mouse event separately, so that users can control mouse events that need to be connect “group” in a more granular way;
   
   ```
   var dom = document.getElementById('chart-container');
   var dom1 = document.getElementById('chart-container1');
   
   var myChart = echarts.init(dom, null, {
     renderer: 'canvas',
     useDirtyRect: false
   });
   var myChart1 = echarts.init(dom1, null, {
     renderer: 'canvas',
     useDirtyRect: false
   });
   var app = {};
   
   var option;
   
   option = {
     title: {
       text: 'Stacked Area Chart'
     },
     tooltip: {
       trigger: 'axis',
       axisPointer: {
         type: 'cross',
         label: {
           backgroundColor: '#6a7985'
         }
       }
     },
     legend: {
       data: ['Email', 'Union Ads', 'Video Ads', 'Direct', 'Search Engine']
     },
     toolbox: {
       feature: {
         saveAsImage: {}
       }
     },
     grid: {
       left: '3%',
       right: '4%',
       bottom: '3%',
       containLabel: true
     },
     xAxis: [
       {
         type: 'category',
         boundaryGap: false,
         data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
       }
     ],
     yAxis: [
       {
         type: 'value'
       }
     ],
     series: [
       {
         name: 'Email',
         type: 'line',
         stack: 'Total',
         areaStyle: {},
         emphasis: {
           focus: 'series'
         },
         data: [120, 132, 101, 134, 90, 230, 210]
       },
       {
         name: 'Union Ads',
         type: 'line',
         stack: 'Total',
         areaStyle: {},
         emphasis: {
           focus: 'series'
         },
         data: [220, 182, 191, 234, 290, 330, 310]
       },
       {
         name: 'Video Ads',
         type: 'line',
         stack: 'Total',
         areaStyle: {},
         emphasis: {
           focus: 'series'
         },
         data: [150, 232, 201, 154, 190, 330, 410]
       },
       {
         name: 'Direct',
         type: 'line',
         stack: 'Total',
         areaStyle: {},
         emphasis: {
           focus: 'series'
         },
         data: [320, 332, 301, 334, 390, 330, 320]
       },
       {
         name: 'Search Engine',
         type: 'line',
         stack: 'Total',
         label: {
           show: true,
           position: 'top'
         },
         areaStyle: {},
         emphasis: {
           focus: 'series'
         },
         data: [820, 932, 901, 934, 1290, 1330, 1320]
       }
     ]
   };
   
   if (option && typeof option === 'object') {
     myChart.setOption(option);
   }
   if (option && typeof option === 'object') {
     myChart1.setOption(option);
   }
   
   myChart.group = 'group1';
   myChart1.group = 'group1';
   echarts.connect('group1');
   
   window.addEventListener('resize', myChart.resize);
   
   window.addEventListener('resize', myChart1.resize);
   ```
   
   > 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org