2014-10-06 65 views
3

這裏是我的問題,一個小提琴:http://jsfiddle.net/v0bxdqa7/5/錯誤對準highcharts日期時間點與x軸

正如你所看到的,點不與x軸值一致。

我從高樓網站上顯示的例子中相信,問題出在我的數據上,但是我找不到確切的問題。

任何想法?

我的選擇:

 rangeSelector: { 
     inputEnabled: false, 
     selected: 1, 
     buttons: [{ 
      type: 'day', 
      count: 7, 
      text: '7' 
     }, { 
      type: 'day', 
      count: 30, 
      text: '30' 
     }, { 
      type: 'year', 
      count: 1, 
      text: '365' 
     }, { 
      type: 'ytd', 
      text: 'year' 
     }] 
    }, 
    tooltip: { 
     headerFormat: '<small style="color: #666680">{point.key}</small><br>', 
     pointFormat: '<span style="color: #acacbf">{series.name}: </span>' + 
     '<span style="color: #666680"><b>{point.y}</b></span>' 
    }, 
    xAxis: { 
     lineColor: '#ebebeb', 
     type: 'datetime', 
     labels: { 
      style: { 
       color: '#acacbf' 
      }, 
      align: "center", 
      maxStaggerLines: 1, 
      overflow: false 
     } 
    }, 
    yAxis: { 
     allowDecimals: false, 
     gridLineWidth: 0, 
     labels: { 
      enabled: false, 
      style: { 
       color: '#acacbf' 
      } 
     }, 
     min: 0, 
     floor: 0, 
     minRange:1 
    }, 
    navigator: {enabled: false}, 
    chart: { 
     className: "line-chart", 
     backgroundColor: "#f7f7f7", 
     margin:[10,5,22,5] 
    }, 
    plotOptions: { 
     series: { 
      marker: { 
       enabled: true, 
       states: { 
        hover: { 
         radius: 5 
        }, 
        select: { 
         enabled: true, 
         radius: 5, 
         fillColor: '#ffffff', 
         lineColor: '#ad49a5' 
        } 
       } 
      } 
     } 
    }, 
    scrollbar: { 
     enabled: false 
    }, 
    colors: ["#ad49a5"] 
+4

所有日期時間數據點的時間部分都是'15:08',當Highcharts打出x軸時,打勾是在一天的開始,而不是3小時,下午8分鐘。 – Mark 2014-10-06 18:41:06

+4

這是一個固定的小提琴:http://jsfiddle.net/v0bxdqa7/6/ – Mark 2014-10-06 18:51:20

回答

0

Indead你(時間戳)的數據是錯誤的。

以第一個爲例:1370787037000如果您將其轉換成Sun, 09 Jun 2013 14:10:37 GMT,那麼這正是圖表上繪製的內容。

如果您希望此點準確位於Sun, 09 Jun 2013 00:00:00 GMT那麼它的正確時間戳是1370736000000。你必須爲每個日期做這件事。