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/04/08 03:32:26 UTC

[GitHub] [incubator-echarts] daxiongok commented on issue #12327: Use setOption method will clear series.data after used appendData to load series.data

daxiongok commented on issue #12327: Use setOption method will clear series.data after used appendData to load series.data
URL: https://github.com/apache/incubator-echarts/issues/12327#issuecomment-610732833
 
 
   > @daxiongok Please provide a demo for the issue either with https://jsfiddle.net/ovilia/n6xc4df3/ or https://gallery.echartsjs.com/editor.html.
   
   `var data = [];
   var now = +new Date(1997, 9, 3);
   var oneDay = 24 * 3600 * 1000;
   var value = Math.random() * 1000;
   function randomData() {
       now = new Date(+now + oneDay);
       value = value + Math.random() * 21 - 10;
       return {
           name: now.toString(),
           value: [
               [now.getFullYear(), now.getMonth() + 1, now.getDate()].join('/'),
               Math.round(value)
           ]
       };
   }
    option = {
       title: {
           text: '动态数据 + 时间坐标轴'
       },
       
       tooltip: {
           trigger: 'axis'
       },
       xAxis: {
           type: 'time',
           splitLine: {
               show: false
           }
       },
       
       yAxis: {
           type: 'value',
           boundaryGap: [0, '100%'],
           splitLine: {
               show: false
           }
       },
       series: [{
           name: '模拟数据',
           type: 'line',
           showSymbol: false,
           hoverAnimation: false,
           data: []
       }]
   };
   
   var iter=setTimeout(function () {
       option.series=[{
           name: '模拟数据',
           type: 'line',
           showSymbol: false,
           hoverAnimation: false
       }];
      myChart.setOption(option, true,true);
       for (var i = 0; i < 15; i++) {
       myChart.appendData({
          seriesIndex: "0",
          data: [randomData()]
       });
       }
      myChart.setOption({title:{show:true,text:"aaa"},series:[{type: 'line',markPoint: null}]})
   }, 500);`

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


With regards,
Apache Git Services

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