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 2020/08/19 19:15:05 UTC

[GitHub] [incubator-echarts] aadgithub opened a new issue #13157: How to get children nodes data on click of bottom lables

aadgithub opened a new issue #13157:
URL: https://github.com/apache/incubator-echarts/issues/13157


   ### Version
   4.4.2
   
   ### Reproduction link
   [https://jsfiddle.net/yxtn0gwd/1/](https://jsfiddle.net/yxtn0gwd/1/)
   
   ### Steps to reproduce
   On tree map at bottom it shows hierarchy of levels.
   on click of parent level want all children level nodes data. 
   in attached demo 
      click on    Disk Usage => Gold
   
   ### What is expected?
   in demo  on click of 'Gold' from top left corner in map it gives all children data in click event.
   
    on click  Disk Usage =>Gold from bottom hierarchy it should give all children data of Gold.
   
   ### What is actually happening?
   It is not returning children data of Gold in click event.
   ![Screenshot from 2020-08-20 00-43-41](https://user-images.githubusercontent.com/24888088/90679796-53541f00-e27e-11ea-928d-dc51b3e4d61a.png)
   
   <!-- This issue is generated by echarts-issue-helper. DO NOT REMOVE -->
   <!-- This issue is in English. DO NOT REMOVE -->


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

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] [incubator-echarts] echarts-bot[bot] commented on issue #13157: How to get children nodes data on click of bottom lables

Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on issue #13157:
URL: https://github.com/apache/incubator-echarts/issues/13157#issuecomment-676610578


   Hi! We've received your issue and please be patient to get responded. 🎉
   The average response time is expected to be within one day for weekdays.
   
   In the meanwhile, please make sure that **you have posted enough image to demo your request**. You may also check out the [API](http://echarts.apache.org/api.html) and [chart option](http://echarts.apache.org/option.html) to get the answer.
   
   If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to dev@echarts.apache.org. Please attach the issue link if it's a technical questions.
   
   If you are interested in the project, you may also subscribe our [mail list](https://echarts.apache.org/en/maillist.html).
   
   Have a nice day! 🍵


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

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] [incubator-echarts] plainheart commented on issue #13157: How to get children nodes data on click of bottom lables

Posted by GitBox <gi...@apache.org>.
plainheart commented on issue #13157:
URL: https://github.com/apache/incubator-echarts/issues/13157#issuecomment-676836144


   It seems that there is no direct and simple way to get the children nodes of clicked level node in the breadcrumb.
   There is a workaround for your reference.
   
   ```js
   myChart.on('click', function(e) {
       var series = myChart.getModel().getSeriesByName('Disk Usage')[0]; // or use getSeriesByIndex(index)
       var allNodes = [];
       flattenNodes(series.getViewRoot(), allNodes);
       var clickedNode = allNodes.find(function(t) {
           return t.dataIndex === e.nodeData.dataIndex;
       });
       var children = clickedNode.children;
       console.log('clicked', e.nodeData.dataIndex, e.nodeData.name, 'children nodes', children);
   })
   
   function flattenNodes(root, nodes) {
       nodes.push(root);
       if (root.children) {
           root.children.forEach(function(c) {
               flattenNodes(c, 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.

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] [incubator-echarts] plainheart edited a comment on issue #13157: How to get children nodes data on click of bottom lables

Posted by GitBox <gi...@apache.org>.
plainheart edited a comment on issue #13157:
URL: https://github.com/apache/incubator-echarts/issues/13157#issuecomment-676836144


   It seems that there is no direct and simple way to get the children nodes of clicked level node in the breadcrumb.
   There is a workaround for your reference.
   
   ```js
   myChart.on('click', function(e) {
       if (e.selfType !== 'breadcrumb') {
           return;
       }
       var series = myChart.getModel().getSeriesByName('Disk Usage')[0]; // or use getSeriesByIndex(index)
       var allNodes = [];
       flattenNodes(series.getViewRoot(), allNodes);
       var clickedNode = allNodes.find(function(t) {
           return t.dataIndex === e.nodeData.dataIndex;
       });
       var children = clickedNode.children;
       console.log('clicked', e.nodeData.dataIndex, e.nodeData.name, 'children nodes', children);
   })
   
   function flattenNodes(root, nodes) {
       nodes.push(root);
       if (root.children) {
           root.children.forEach(function(c) {
               flattenNodes(c, 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.

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] [incubator-echarts] plainheart closed issue #13157: How to get children nodes data on click of bottom lables

Posted by GitBox <gi...@apache.org>.
plainheart closed issue #13157:
URL: https://github.com/apache/incubator-echarts/issues/13157


   


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

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] [incubator-echarts] aadgithub commented on issue #13157: How to get children nodes data on click of bottom lables

Posted by GitBox <gi...@apache.org>.
aadgithub commented on issue #13157:
URL: https://github.com/apache/incubator-echarts/issues/13157#issuecomment-680009866


   Thank you @plainheart 
   Working as expected.


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

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