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/08/26 09:38:23 UTC

[GitHub] [echarts] weihaopeng opened a new 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

weihaopeng opened a new issue, #17577:
URL: https://github.com/apache/echarts/issues/17577

   ### Version
   
   5.3.3
   
   ### Link to Minimal Reproduction
   
   https://codesandbox.io/s/les-miserables-forked-xz43i6?file=/index.js
   
   ### Steps to Reproduce
   
   See detail in the Minimal Reproduction.
   1. The graph have simple nodes and links, root -> a -> b, root -> c -> a. There two nodes with same name `a` but different id.
   2. Minimal Reproduction will auto select nodes `a, c, root` in 3 seconds after the chart finished.
   
   ### Current Behavior
   
   When select `node a` with id 4, the other `node a` with id 1 is selected.
   
   ### Expected Behavior
   
   If I use `dispatchAction` funciton with `name` attribute `[a] or a`, selected all nodes named `a` is right. But when I use the function with `dataIndex` attribute, it should only select the specific node.
   
   ### Environment
   
   ```markdown
   - OS: Mac OS X 10_15_7
   - Browser: Chrome/104.0.0.0
   - Framework: doesn't matter.
   ```
   
   
   ### Any additional comments?
   
   _No response_


-- 
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.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


[GitHub] [echarts] weihaopeng 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

Posted by GitBox <gi...@apache.org>.
weihaopeng commented on issue #17577:
URL: https://github.com/apache/echarts/issues/17577#issuecomment-1228284390

   In case the link expires.
   
   ```
   var dom = document.getElementById("chart-container");
   var myChart = echarts.init(dom, null, {
     renderer: "canvas",
     useDirtyRect: false
   });
   var option = {
     animationDuration: 1500,
     animationEasingUpdate: "quinticInOut",
     series: [
       {
         name: "simple force",
         type: "graph",
         layout: "force",
         data: [
           { id: 0, name: "root", symbolSize: 30 },
           { id: 1, name: "a" },
           { id: 2, name: "b" },
           { id: 3, name: "c" },
           { id: 4, name: "a" }
         ],
         links: [
           { source: 0, target: 1 },
           { source: 1, target: 2 },
           { source: 0, target: 3 },
           { source: 3, target: 4 }
         ],
         label: {
           show: true,
           position: "right",
           formatter: "{b}"
         },
         selectedMode: "multiple",
         select: {
           disabled: false,
           itemStyle: {
             color: "red"
           }
         }
       }
     ]
   };
   myChart.setOption(option);
   
   if (option && typeof option === "object") {
     myChart.setOption(option);
   }
   
   window.addEventListener("resize", myChart.resize);
   
   myChart.on("finished", () => {
     setTimeout(() => {
       myChart.dispatchAction({
         type: "select",
         dataIndex: [4, 3, 0]
       });
     }, 3000);
   });
   ```


-- 
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


[GitHub] [echarts] weihaopeng 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

Posted by GitBox <gi...@apache.org>.
weihaopeng commented on issue #17577:
URL: https://github.com/apache/echarts/issues/17577#issuecomment-1233709121

   I am agree with your point about series. But what I propose is that in the same series, 3 points form an array in different order, and the final highlighting effect is inconsistent. I don't think this should be right.
   Please see my example.


-- 
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


[GitHub] [echarts] weihaopeng 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

Posted by GitBox <gi...@apache.org>.
weihaopeng commented on issue #17577:
URL: https://github.com/apache/echarts/issues/17577#issuecomment-1233720585

   This means you set name as the key of node. Ok, I can set label `{c}`, and the name of node not duplicate.
   
   ![image](https://user-images.githubusercontent.com/33681454/187829546-e760b54a-f7f5-4283-9ea9-04488a967251.png)
   
   ![image](https://user-images.githubusercontent.com/33681454/187829970-b75f1d5a-0716-4e10-93e2-16cadf0dc49f.png)
   
   I have a suggestion:
   *  Modify the document in image 2 above, `数据项名称` -> `数据项名称(键值)`. It is easy to misunderstand that this value is label, not a key.
   
   Besides this, I think my question is still a bug. If I use `dataName` in dispatchAction function, you select nodes by `name` is right. But I use `dataIndex` in the funciton, the result should be the node with specific index is highlight, not get the node with index then get the same name nodes.


-- 
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


[GitHub] [echarts] Ovilia 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

Posted by GitBox <gi...@apache.org>.
Ovilia commented on issue #17577:
URL: https://github.com/apache/echarts/issues/17577#issuecomment-1228294806

   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.


-- 
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


[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

Posted by GitBox <gi...@apache.org>.
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