2017-01-17 75 views
0

我顯示了錯誤的點數據。 它不顯示正確的數據,檢查出圖片。HighCharts:datetime xaxis上顯示的錯誤數據

起始點是Date.UTC(2016,06,30),而不是在工具提示中的Date.UTC(2016,07,30)。下面是結果我得到:

enter image description here

$(function() { 
    Highcharts.chart('container', { 
    chart: { 
     type: 'spline' 
    }, 
    title: { 
     text: 'Waterflow' 
    }, 
    xAxis: { 
     type: 'datetime', 
     dateTimeLabelFormats: { 
     day: '%e' 
     }, 
     title: { 
     text: 'Date' 
     } 
    }, 
    yAxis: { 
     title: { 
     text: 'Flow im Mio' 
     }, 
     min: 0 
    }, 
    tooltip: { 
     headerFormat: '<b>{series.name}</b><br>', 
     pointFormat: '{point.x:%e. %b}: {point.y:.2f} m' 
    }, 
    plotOptions: { 
     spline: { 
     marker: { 
      enabled: true 
     } 
     } 
    }, 
    series: [{ 
     name: 'Main', 
     data: ([ 
     [Date.UTC(2016, 06, 30), 3072.541365], 
     [Date.UTC(2016, 07, 31), 3315.618228], 
     [Date.UTC(2016, 08, 31), 3367.458135], 
     [Date.UTC(2016, 09, 30), 3370.195785], 
     [Date.UTC(2016, 10, 31), 3424.501986], 
     [Date.UTC(2016, 11, 30), 3479.865412], 
     [Date.UTC(2016, 12, 31), 3521.730275], 
     ]) 
    }, ] 
    }); 
}); 

回答

0

Date.UTC(Year,Month*,Day,Hour,Minute,Seconds)從開始。這在documentation中提到。

June,你必須使用5,而不是6所以要指定月份。

+0

謝謝,對不起,我讀了很多次,但沒有認出'0' – Dirk