2013-04-12 49 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