Does anyone know how to make "y-axis" values start from 0 in Jqplot....by default it starts with negative values for eg: -500, 0, 500, 1000 and so on....Please help
有人知道如何使“轴”值从0开始Jqplot ....默认情况下它始于负值如:-500 0、500、1000和....请帮助
6 个解决方案
#1
19
Set min: object (minimum) to 0 within axes: object
在坐标轴:对象中,将最小值设为0
$(document).ready(function(){
// your code here... //
axes:{
yaxis: {min:0}
}
})
As rsapru suggested, a max: object (maximum) value is recommended to bound the graph to your preferred range. For example, if you wanted the minimum to be 0 and maximum to be 7500
正如rsapru所建议的,建议使用max: object (maximum)值将图形绑定到您的首选范围。例如,如果你要求最小值为0,最大值为7500。
axes:{
yaxis: {min:0, max: 7500}
}
If you want to specify the graduations of the ticks you can do so manually by specifying ticks with the ticks: object or have jqPlot calculate tick spacing automatically (nothing other than min and max objects would be needed in that case) or by your specific number of ticks (using numberTicks: object)
如果你想指定的毕业典礼蜱可以手动指定蜱蜱虫:对象或jqPlot计算刻度间隔自动(min和max对象需要在这种情况下),或者你的特定数量的蜱虫(使用numberTicks:对象)
Example: For tick 100 units apart, from 0 to 1000, using 11 ticks (0,100,200,300,400,500,600,700,800,900,1000) jqPlot automatic calculation:
例子:对于分项为100的单位,从0到1000,使用11个节拍(0,100,200,300,400,500,600,700,800,900,1000)jqPlot自动计算:
axes:{
yaxis: {min:0, max: 1000, numberTicks: 11}
}
Example: For tick 100 units apart, from 0 to 1000, using 11 ticks (0,100,200,300,400,500,600,700,800,900,1000) manual specification:
例子:对于蜱100个单位,从0到1000,使用11个蜱(0,100,200,300,400,500,600,800,900,1000)手册说明:
axes:{
yaxis: {min:0, max: 1000, Ticks: [[0],[100],[200],[300],[400],[500],[600],[700],[800],[900],[1000]]}
}
#2
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
}
}
});
pad: 0 will star the Y axis to start from 0.
垫:0为Y轴,从0开始。
#3
3
Refer to http://www.jqplot.com/docs/files/jqPlotOptions-txt.html
指的是http://www.jqplot.com/docs/files/jqPlotOptions-txt.html
set yaxis: {min: 0, max: 500, numberTicks:5}
设置yaxis: {min: 0, max: 500, numbertick:5}
#4
0
The following solution work for me.
下面的解决方案对我有效。
-> Add zero value in array also.
->在数组中添加0值。
-> set the data render to $.jqplot.CanvasAxisLabelRenderer
->将数据呈现设置为$.jqplot.CanvasAxisLabelRenderer
yaxis: { renderer: $.jqplot.CanvasAxisLabelRenderer .....
桠溪:{渲染器:.jqplot美元。CanvasAxisLabelRenderer .....
}
Thanks Adnan
由于Adnan
#5
0
add yaxis: {min:0} in your yaxis
在yaxis中添加yaxis: {min:0}
#6
0
Add the following to the script:
在脚本中增加以下内容:
yaxis: {
minimum:0
}
in your yaxis. I tried it and it works.
桠溪。我试过了,它成功了。
#1
19
Set min: object (minimum) to 0 within axes: object
在坐标轴:对象中,将最小值设为0
$(document).ready(function(){
// your code here... //
axes:{
yaxis: {min:0}
}
})
As rsapru suggested, a max: object (maximum) value is recommended to bound the graph to your preferred range. For example, if you wanted the minimum to be 0 and maximum to be 7500
正如rsapru所建议的,建议使用max: object (maximum)值将图形绑定到您的首选范围。例如,如果你要求最小值为0,最大值为7500。
axes:{
yaxis: {min:0, max: 7500}
}
If you want to specify the graduations of the ticks you can do so manually by specifying ticks with the ticks: object or have jqPlot calculate tick spacing automatically (nothing other than min and max objects would be needed in that case) or by your specific number of ticks (using numberTicks: object)
如果你想指定的毕业典礼蜱可以手动指定蜱蜱虫:对象或jqPlot计算刻度间隔自动(min和max对象需要在这种情况下),或者你的特定数量的蜱虫(使用numberTicks:对象)
Example: For tick 100 units apart, from 0 to 1000, using 11 ticks (0,100,200,300,400,500,600,700,800,900,1000) jqPlot automatic calculation:
例子:对于分项为100的单位,从0到1000,使用11个节拍(0,100,200,300,400,500,600,700,800,900,1000)jqPlot自动计算:
axes:{
yaxis: {min:0, max: 1000, numberTicks: 11}
}
Example: For tick 100 units apart, from 0 to 1000, using 11 ticks (0,100,200,300,400,500,600,700,800,900,1000) manual specification:
例子:对于蜱100个单位,从0到1000,使用11个蜱(0,100,200,300,400,500,600,800,900,1000)手册说明:
axes:{
yaxis: {min:0, max: 1000, Ticks: [[0],[100],[200],[300],[400],[500],[600],[700],[800],[900],[1000]]}
}
#2
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
}
}
});
pad: 0 will star the Y axis to start from 0.
垫:0为Y轴,从0开始。
#3
3
Refer to http://www.jqplot.com/docs/files/jqPlotOptions-txt.html
指的是http://www.jqplot.com/docs/files/jqPlotOptions-txt.html
set yaxis: {min: 0, max: 500, numberTicks:5}
设置yaxis: {min: 0, max: 500, numbertick:5}
#4
0
The following solution work for me.
下面的解决方案对我有效。
-> Add zero value in array also.
->在数组中添加0值。
-> set the data render to $.jqplot.CanvasAxisLabelRenderer
->将数据呈现设置为$.jqplot.CanvasAxisLabelRenderer
yaxis: { renderer: $.jqplot.CanvasAxisLabelRenderer .....
桠溪:{渲染器:.jqplot美元。CanvasAxisLabelRenderer .....
}
Thanks Adnan
由于Adnan
#5
0
add yaxis: {min:0} in your yaxis
在yaxis中添加yaxis: {min:0}
#6
0
Add the following to the script:
在脚本中增加以下内容:
yaxis: {
minimum:0
}
in your yaxis. I tried it and it works.
桠溪。我试过了,它成功了。