You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "im67 (via GitHub)" <gi...@apache.org> on 2025/02/17 04:01:18 UTC

Re: [I] [Bug] Tree chart: expanded/collapsed state of parent nodes is reset on zoom [echarts]

im67 commented on issue #19289:
URL: https://github.com/apache/echarts/issues/19289#issuecomment-2661915669

   In the data of the series, the collapsed field controls expansion/collapse. So a feasible way is to modify the value of the collapsed field in the click event for expansion/collapse. A simple example is as follows:
   ```
       treeChart.on('click', function (params) {
           if (params.componentType === 'series') {
               params.data.collapsed = !params.data.collapsed;
           }
       });
   
     // on Zoom
   const onZoom = () => {
     const opt = treeChart.getOption();
     treeChart.setOption({
       series: [
           {
               zoom: opt.series[0].zoom + 0.1
           }
       ]
     })
   }
   ```
   then you can see that the expanded/collapsed state is correctly preserved. As a temporary solution, I hope it can help others
   :)


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