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 2018/04/23 07:32:54 UTC

[GitHub] Zz1Change opened a new issue #8210: 设置X轴最小值后,折线图最后一个数据回连(数据已正确排序)

Zz1Change opened a new issue #8210: 设置X轴最小值后,折线图最后一个数据回连(数据已正确排序)
URL: https://github.com/apache/incubator-echarts/issues/8210
 
 
   <!--
   为了方便我们能够复现和修复 bug,请遵从下面的规范描述您的问题。
   -->
   
   
   ### One-line summary [问题简述]
   1.动态折线图,dataset数据为动态,设置了connectNulls=true.
   初始X轴(time)最大最小值为默认的空,数据导入set option后正常
   随着时间的过去,会在某一刻,删掉一些前面的数据 然后set option设置X轴的最小值,
   在设置完后,图表末尾几个点就错乱,具体表现为最后一个点往回连到倒数第四个点
   检查过dataset数据的X轴时间排序没问题.
   又过了一阵子,再到下一跳新数据set进去,图表又正常了.
   请问如何解决?
   设置了X轴最小值后有没有相应操作能让图表强制刷新一下?
   2.设置了yAxis.scale=true,但是当数据为0的时候,直线不在垂直方向的中央,而是贴在最底下0,感觉像是默认
   不显示负数范围一样
   
   
   ### Version & Environment [版本及环境]
   + ECharts version [ECharts 版本]:4.0.4
   + Browser version [浏览器类型和版本]:firefox59.0.1
   + OS Version [操作系统类型和版本]:win 10
   
   ### Expected behaviour [期望结果]
   1.设置X轴最小值后,图表折线不再发生错乱(最后一个点往回连线)
   2.数据不好的时候(全为0)的一条直线,显示在图表垂直居中,而不是现在贴在最底下0
   
   ### ECharts option [ECharts配置项]
   <!-- Copy and paste your 'echarts option' here. -->
   <!-- [下方贴你的option,注意不要删掉下方 ```javascript 和 尾部的 ``` 字样。最好是我们能够直接运行的 option。如何得到能运行的 option 参见上方的 guidelines for contributing] -->
   ```javascript
   var option    = {
               tooltip: {
                   //trigger:'item',
                   transitionDuration: 0,
                   axisPointer: {
                       type: 'cross',
                       label: {
                           precision: 4
                       }
                   },
                   padding: 3,
                   textStyle: {
                       fontSize: 10,
                       lineHeight: 12
                   },
                   formatter: function (params) {
                       var res = 'Time:' + params.data.time;
                       if (params.value.sentiment) {
                           res += '<br/>Sentiment:' + params.value.sentiment
                       }
                       if (params.value.bid) {
                           res += '<br/>Bid:' + params.value.bid
                       }
                       if (params.value.ask) {
                           res += '<br/>Ask:' + params.value.ask
                       }
                       return res
                   }
               },
               dataset: [
                   {
                       dimensions: ['time', 'sentiment'],
                       source:[{"sentiment":"0.00000000","time":"2018-04-23 14:46:01"},{"sentiment":"0.00000000","time":"2018-04-23 14:47:05"},{"sentiment":"0.00000000","time":"2018-04-23 14:48:01"},{"sentiment":"0.00000000","time":"2018-04-23 14:49:02"},{"sentiment":"0.00000000","time":"2018-04-23 14:50:04"},{"sentiment":"0.00000000","time":"2018-04-23 14:51:00"},{"sentiment":"0.00000000","time":"2018-04-23 14:52:00"},{"sentiment":"0.00000000","time":"2018-04-23 14:53:01"},{"sentiment":"0.00000000","time":"2018-04-23 14:54:00"},{"sentiment":"0.00000000","time":"2018-04-23 14:55:01"},{"sentiment":"0.00000000","time":"2018-04-23 14:56:02"},{"sentiment":"0.00000000","time":"2018-04-23 14:57:00"},{"sentiment":"0.00000000","time":"2018-04-23 14:58:00"},{"sentiment":"0.00000000","time":"2018-04-23 14:59:02"},{"sentiment":"0.00000000","time":"2018-04-23 15:01:36"},{"sentiment":"0.00000000","time":"2018-04-23 15:02:00"},{"sentiment":"0.00000000","time":"2018-04-23 15:03:04"},{"sentiment":"0.00000000","time":"2018-04-23 15:04:00"},{"sentiment":"0.00000000","time":"2018-04-23 15:05:01"},{"sentiment":"0.00000000","time":"2018-04-23 15:06:00"},{"sentiment":"0.00000000","time":"2018-04-23 15:07:03"},{"sentiment":"0.00000000","time":"2018-04-23 15:08:01"},{"sentiment":"0.00000000","time":"2018-04-23 15:09:05"},{"sentiment":"0.00000000","time":"2018-04-23 15:10:00"},{"sentiment":"0.00000000","time":"2018-04-23 15:11:01"},{"sentiment":"0.00000000","time":"2018-04-23 15:12:00"}]
                   },
                   {
                       dimensions: ['time', 'ask', 'bid'],
                       source:[{"ask":1.2273,"time":"2018-04-23 14:45:00","bid":1.2272},{"ask":1.227,"time":"2018-04-23 14:46:00","bid":1.2267},{"ask":1.2273,"time":"2018-04-23 14:47:00","bid":1.2271},{"ask":1.2274,"time":"2018-04-23 14:48:00","bid":1.2271},{"ask":1.2274,"time":"2018-04-23 14:49:00","bid":1.2272},{"ask":1.2275,"time":"2018-04-23 14:50:00","bid":1.2271},{"ask":1.2273,"time":"2018-04-23 14:51:00","bid":1.2272},{"ask":1.2275,"time":"2018-04-23 14:52:00","bid":1.2271},{"ask":1.2274,"time":"2018-04-23 14:53:00","bid":1.227},{"ask":1.2274,"time":"2018-04-23 14:54:00","bid":1.227},{"ask":1.2278,"time":"2018-04-23 14:55:00","bid":1.2277},{"ask":1.2277,"time":"2018-04-23 14:57:00","bid":1.2273},{"ask":1.2276,"time":"2018-04-23 14:58:00","bid":1.2275},{"ask":1.2278,"time":"2018-04-23 14:59:00","bid":1.2276},{"ask":1.2276,"time":"2018-04-23 15:00:00","bid":1.2272},{"ask":1.2281,"time":"2018-04-23 15:01:00","bid":1.2278},{"ask":1.228,"time":"2018-04-23 15:02:00","bid":1.2279},{"ask":1.2283,"time":"2018-04-23 15:03:00","bid":1.2281},{"ask":1.2287,"time":"2018-04-23 15:04:00","bid":1.2283},{"ask":1.2286,"time":"2018-04-23 15:05:00","bid":1.2284},{"ask":1.229,"time":"2018-04-23 15:06:00","bid":1.2286},{"ask":1.2291,"time":"2018-04-23 15:07:00","bid":1.2288},{"ask":1.2291,"time":"2018-04-23 15:08:00","bid":1.2287},{"ask":1.2286,"time":"2018-04-23 15:09:00","bid":1.2285},{"ask":1.2286,"time":"2018-04-23 15:10:00","bid":1.2283},{"ask":1.2284,"time":"2018-04-23 15:11:00","bid":1.228},{"ask":1.2284,"time":"2018-04-23 15:12:00","bid":1.2282}]
                   }
               ],
               grid: {
                   show: false,
                   left: '10.142%',
                   top: 10,
                   right: '10.142%',
                   bottom: 5
               },
               xAxis: {
                   type: 'time',
                   show: false,
                   position: 'bottom'
               },
               yAxis: [
                   {
                       type: 'value',
                       position: 'left',
                       splitLine: {
                           show: false
                       },
                       scale: true,
                       boundaryGap: ['10%', '10%']
                   },
                   {
                       type: 'value',
                       position: 'right',
                       splitLine: {
                           show: false
                       },
                       scale: true,
                       boundaryGap: ['10%', '10%']
                   }
               ],
               series: [
                   {
                       name: 'Sentiment',
                       type: 'line',
                       yAxisIndex: 0,
                       datasetIndex: 0,
                       connectNulls: true,
                       smooth:true,
                       encode: {
                           x: 'time',
                           y: 'sentiment'
                       },
                   },
                   {
                       name: 'Bid',
                       type: 'line',
                       yAxisIndex: 1,
                       datasetIndex: 1,
                       connectNulls: true,
                       smooth:true,
                       encode: {
                           x: 'time',
                           y: 'bid'
                       },
                   },
                   {
                       name: 'Ask',
                       type: 'line',
                       yAxisIndex: 1,
                       datasetIndex: 1,
                       connectNulls: true,
                       smooth:true,
                       encode: {
                           x: 'time',
                           y: 'ask'
                       },
                   }
               ],
               dataZoom: [
                   {
                       type: 'inside'
                   }
               ]
           };
   
   
   ```
   
   
   
   ### Other comments [其他信息]
   <!-- For example: Screenshot or Online demo -->
   <!-- [例如,截图或线上实例 (JSFiddle/JSBin/Codepen)] -->
   ![tim 20180423152607](https://user-images.githubusercontent.com/26222260/39112561-71fb7e00-470b-11e8-8d54-9772ef31c72d.png)
   ![tim 20180423152618](https://user-images.githubusercontent.com/26222260/39112563-72346a76-470b-11e8-9a75-2363c0cbac83.png)
   
   
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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