2011-06-01 151 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。我试了一下,它的工作原理。