折线图未正确显示

时间:2018-04-19 08:35:46

标签: javascript highcharts

我使用Highcharts来显示来自mongo数据库的数据,使用服务器端的节点驱动程序。

问题是生成的折线图是"凌乱"我不明白为什么。



 Highcharts.chart('container', {
          chart: {
            type: 'line',
            renderTo: 'container'
          },
          title: {
            text: 'sensors data'
          },
          xAxis: {
                      type: 'datetime',
                      text : 'Timestamp H-M-S',
                      labels: {
                        formatter: function () {
                          return Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.value);
                        }
                      },
                      ordinal: false,
                    },
          yAxis: {
            title: {
              text: 'temperature'
            }
          },

          series: [{
            name: 'sensor0',
            data: [[1524106747468,24.6],[1524106817643,24.6],[1524106907826,24.6],[1524106917831,24.6],[1524106947890,24.6],[1524106987955,24.6],[1524107088179,24.6],[1524107098187,24.6],[1524107148299,24.6],[1524107258502,24.6],[1524107298575,24.6],[1524107361020,24],[1524107381081,23.9],[1524107521325,23.9],[1524107551411,23.9],[1524107631577,24.1],[1524106757495,24.6],[1524106777546,24.6],[1524106857719,24.6],[1524106877761,24.6],[1524106937870,24.6],[1524106997976,24.6],[1524107007992,24.6],[1524107118240,24.6],[1524107208425,24.6],[1524107308599,24.6],[1524107441184,24],[1524107581491,23.9]]
          }]
        });
 

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/series-label.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>

<div id="container"></div>
&#13;
&#13;
&#13;

0 个答案:

没有答案
相关问题