You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@echarts.apache.org by GitBox <gi...@apache.org> on 2019/07/09 05:21:59 UTC

[GitHub] [incubator-echarts] chunsh opened a new issue #10823: 折线图动态加入数据,折线左侧乱连

chunsh opened a new issue #10823: 折线图动态加入数据,折线左侧乱连
URL: https://github.com/apache/incubator-echarts/issues/10823
 
 
   ### Version
   4.2.1
   
   ### Steps to reproduce
   ``` js
   function randomData() {
       now = new Date( now   oneDay);
       value =  Math.random()* 1000;
       return {
           name: now.toString(),
           value: [
               [now.getFullYear(), now.getMonth()   1, now.getDate()].join('/'),
               Math.round(value)
           ]
       }
   }
   
   var data = [];
   var now =  new Date(1997, 9, 3);
   var oneDay = 24 * 3600 * 1000;
   var value = Math.random() * 1000;
   for (var i = 0; i < 1000; i  ) {
       data.push(randomData());
   }
   
   option ={
           title: {
             text: '123546',
             textStyle: {
               color: '#333',
               fontWeight: 'bold'
             },
             padding: [10, 0]
           },
           grid: {
             left: 30,
             right: 30,
             bottom: 20,
             top: 50,
             containLabel: true
           },
           tooltip: {
           formatter: function (params) {
               params = params[0];
               var date = new Date(params.name);
               return date.getDate()   '/'   (date.getMonth()   1)   '/'   date.getFullYear()   ' : '   params.value[1];
           },
             trigger: 'axis',
             padding: [5, 10]
           },
           dataZoom: [{
             // startValue: '2012-06-01',
           }, {
             type: 'inside'
           }],
           xAxis: {
             type: 'time', // time
             axisTick: {
               show: false
             }
           },
           yAxis: {
             type: 'value',
             splitLine: {
               show: true
             },
             axisTick: {
               show: false
             }
           },
           series: [{
             name: 'series',
             type: 'line',
             smooth: false,
             data: data,
             animationDuration: 2800,
             animationEasing: 'quadraticOut'
           }]
         };
   
   setInterval(function () {
   
       for (var i = 0; i < 5; i  ) {
           data.shift();
           data.push(randomData());
       }
   
       myChart.setOption({
           series: [{
               data: data
           }]
       });
   }, 1000);
   ```
   运行后放大看左边
   
   ### What is expected?
   正常折线
   
   ### What is actually happening?
   折线乱连
   
   <!-- This issue is generated by echarts-issue-helper. 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


With regards,
Apache Git Services

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