2014-06-13 115 views
1

我試圖用jQuery Flot生成圖。 這是腳本進出口使用:jQuery Flot xaxis元素編號

var plot = $.plot("#placeholder", [ 
     { data: data2, label: observation_obj.concept_name} 
    ], { 
     series: { 
      lines: { 
       show: true 
      }, 
      points: { 
       show: true 
      } 
     }, 
     grid: { 
      hoverable: true, 
      clickable: true 
     }, 
     yaxis: { 
     }, 
     xaxis: { 
      mode: "time", 
      timeformat: "%d.%m" 
     } 
    }); 

我得到結果是這樣的:

http://i62.tinypic.com/25uk51z.png

我的數據是包含了兩個點,我不知道爲什麼在x軸I看到4分,

任何人都可以幫忙嗎?

由於

+0

你可以用你的數據做一個jsFiddle嗎?你可以修改這個:__http://jsfiddle.net/fMFKw/__ – Sergio

回答

2

在x軸上的刻度是自動生成的,使得它們被均勻地在該軸線間隔開。如果你想改變,你可以給海軍報的數組(你的情況),從您的數據(這裏只是舉例)匹配時間戳其中時間戳:

xaxis: { 
    mode: "time", 
    timeformat: "%d.%m", 
    ticks: [1383582043000, 1383682043000] 
} 

documentation更多的相關信息/例子。