2011-06-01 95 views

回答

19

集分鐘:對象(最小)設爲0:對象

$(document).ready(function(){ 
// your code here... // 
axes:{ 
    yaxis: {min:0} 
} 
}) 

正如rsapru建議的那樣,建議使用max:object(maximum)值將圖形綁定到您的首選範圍。例如,如果你想最低爲0,最高爲7500

axes:{ 
    yaxis: {min:0, max: 7500} 
} 

如果你想通過與蜱指定蜱可指定您可以手動刻度線的刻度:對象或具有jqPlot計算滴答間距(在這種情況下不需要除最小和最大物體以外)或按特定的滴答數量(使用numberTicks:對象)

示例:對於間隔100單位,從0到1000,使用11蜱(0,100,200,300,400,500,600,700,800,900,1000)jqPlot自動計算:

axes:{ 
    yaxis: {min:0, max: 1000, numberTicks: 11} 
} 

示例:對於蜱100個單位分開,從0到1000,使用11個蜱(0,100,200,300,400,500,600,700,800,900,1000)手冊規範:

axes:{ 
    yaxis: {min:0, max: 1000, Ticks: [[0],[100],[200],[300],[400],[500],[600],[700],[800],[900],[1000]]} 
} 
+0

你可以告訴任何方法來計算沒有滴答滴答,沒有明確地設置它,我的意思是,如果圖表正常創建,那麼我們可以得到圖中顯示的滴答否 – 2013-05-27 13:24:49

+0

你能幫助這個one:http://stackoverflow.com/q/16771537/1283215 – 2013-05-27 13:25:53

+0

你可能必須結合Nerds的技術的答案與PackedUp的答案迫使一個零y軸「realsies」,就像這樣:'軸:{yaxis:{min :0,pad:0}}' – 2014-02-03 20:16:47

7
   var plot2 = $.jqplot ('chartdiv', getRequestStats(), { 
       // Give the plot a title. 
       title: 'Daily Request Status', 
       // You can specify options for all axes on the plot at once with 
       // the axesDefaults object. Here, we're using a canvas renderer 
       // to draw the axis label which allows rotated text. 
       axesDefaults: { 
        labelRenderer: $.jqplot.CanvasAxisLabelRenderer 
       }, 
       // An axes object holds options for all axes. 
       // Allowable axes are xaxis, x2axis, yaxis, y2axis, y3axis, ... 
       // Up to 9 y axes are supported. 
       axes: { 
        // options for each axis are specified in seperate option objects. 
        xaxis: { 
         label: "Hour", 
         // Turn off "padding". This will allow data point to lie on the 
         // edges of the grid. Default padding is 1.2 and will keep all 
         // points inside the bounds of the grid. 
         pad: 0 
        }, 
        yaxis: { 
         label: "Count", 
         pad: 0 
        } 
       } 
      }); 

墊:0將星Y軸從0開始。

+0

「pad:0」在Y軸上工作。非常感謝。 – Andree 2013-02-06 16:45:11

+0

我已經在yaxis上有min:0,並且沒有工作。 增加了pad:0和它的工作。 – Kiran 2017-11-01 05:50:52

0

以下解決方案適用於我。

- >在數組中也添加零值。

- >設置數據渲染到$ .jqplot.CanvasAxisLabelRenderer

y軸:{ 渲染:$ .jqplot.CanvasAxisLabelRenderer .....

    } 

感謝 阿德南

0

在yaxis中添加yaxis:{min:0}

0

將以下內容添加到腳本中:

yaxis: { 
    minimum:0 
} 

在你的yaxis。我試了一下,它的工作原理。