2013-04-12 74 views
0

Flot圖不能正確顯示日期/時間。在x軸中有unix時間戳的值。Flot不能正確顯示時間戳/日期

數據:

[[1365712202000,61.39],[1365712510000,60.89],[1365712817000,0]] 

海軍報CONFIGS:

$.plot(plotarea , [ 
     { 
      label: "Value", 
      data: dataLine, 
      color: "#FF8848", 
      lines: { show: true, steps: false }, 
      points: { show: true }, 
      grid: { hoverable: true, clickable: true }, 
      xaxis: { mode: "time", timeformat: "%d/%H/%M" } 
     } 
    ] 

enter image description here

回答

2

你的配置是錯誤的。 xaxisgrid不是系列選項,而是繪圖選項。試試:

$.plot($('#placeholder') ,[{ 
     label: "Value", 
     data: dataLine, 
     color: "#FF8848", 
     lines: { show: true, steps: false }, 
     points: { show: true }    
    }], 
    { 
     grid: { hoverable: true, clickable: true }, 
     xaxis: { mode: "time", timeformat: "%d/%H/%M" } 
    } 
); 

小提琴here

+0

謝謝。它正在工作! +1 – user2035638