2012-01-18 50 views
1

我使用jqplot繪製一個簡單的條形圖,但只有第一個和最後一個條的一半正在渲染。 這裏是圖像enter image description herejqplot在視覺區域外渲染

有沒有辦法讓圖表適合內部?

感謝

UPDATE 在X軸我使用dateAxisRenderer作爲渲染器。

回答

2

axes: { xaxis: { } }選擇我會嘗試使用:

min: null,  // minimum numerical value of the axis. Determined automatically. 
max: null,  // maximum numverical value of the axis. Determined automatically. 
pad: 1.2,  // a factor multiplied by the data range on the axis to give the 
       // axis range so that data points don't fall on the edges of the axis. 

選項。如果這不起作用,您應該嘗試設置最小值和最大值,稍大於數據範圍。

EDITS徵求意見

我想你會發現很多更容易,如果你以來1970/01/01毫秒數的JavaScript標準去與日期的工作。這就是爲什麼使用min/max作爲字符串時出現錯誤的原因。指定這樣的:

min: 1325376000 * 1000, // 2012/01/01 00:00:00 
max: 1326715140 * 1000 // 2012/01/16 11:59:00 

Using this min/max

enter image description here

下一個障礙是,你的日期沒有時間。 JQPlot將這些作爲當天的第一分鐘,所以他們相應地與標籤對齊。如果你想讓他們居中對齊,你需要指定一箇中午12:00的時間。再一次,你可以從字符串中解析出來,但我會切換到毫秒。

+0

嗨。感謝您的回覆。這就是我認爲...但是我使用的是dateAxisRenderer,在這種情況下,我需要指定最小值,否則它會拋出一個JS錯誤,我認爲在這種情況下忽略pad選項。 – 2012-01-20 14:09:10

+0

@DouaBeri,你能設置一個顯示問題的jsfiddle(http://jsfiddle.net/)嗎? – Mark 2012-01-20 15:30:31

+0

如果jsfiddle與其他腳本/ CSS存在某些衝突,那麼http://jsbin.com可能會更好。 – Bruno 2012-01-22 17:08:33