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 2021/06/23 13:03:13 UTC

[GitHub] [echarts] DtStorm commented on issue #15217: 使用树状图tree 的setOptions更新数据后 出现了残留的线图

DtStorm commented on issue #15217:
URL: https://github.com/apache/echarts/issues/15217#issuecomment-866815945


   我把下面的测试代码修改了一下 复现了
   myChart.showLoading();
   $.get(ROOT_PATH + '/data/asset/data/flare.json', function (data) {
       myChart.hideLoading();
   
       data.children.forEach(function (datum, index) {
           index % 2 === 0 && (datum.collapsed = true);
       });
   
       myChart.setOption(option = {
           tooltip: {
               trigger: 'item',
               triggerOn: 'mousemove'
           },
           series: [
               {
                   type: 'tree',
   
                   data: [data],
   
                   top: '1%',
                   left: '7%',
                   bottom: '1%',
                   right: '20%',
   
                   symbolSize: 7,
   
                   label: {
                       position: 'left',
                       verticalAlign: 'middle',
                       align: 'right',
                       fontSize: 9
                   },
   
                   leaves: {
                       label: {
                           position: 'right',
                           verticalAlign: 'middle',
                           align: 'left'
                       }
                   },
   
                   emphasis: {
                       focus: 'descendant'
                   },
   
                   expandAndCollapse: true,
                   animationDuration: 550,
                   animationDurationUpdate: 750
               }
           ]
       });
       
       setTimeout(function() {
           
                const op = myChart.getOption()
           const data = option.series[0].data[0].children[1]
           op.series[0].data = [data]
           myChart.setOption(op,true)
       }
       , 2000);
   });
   
   ![image](https://user-images.githubusercontent.com/56500428/123101206-615a6980-d466-11eb-9f5b-094376b3efde.png)
   


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