kar*_*can 8 jquery user-interface graph jqplot
我正在使用jqPlot来渲染条形图,我希望做一些相当简单的事情,但我不确定图书馆是否有这个选项.
我有这样的图形,其中y轴上的最大可能值可以是42.

假设对于一个案例,我对任何一个柱的最高值是14,那么图形将呈现为最多只显示14个.

但是,我想要这样,在所有情况下,我可以看到42的上限呈现.
这就是我现在所拥有的:
var plot3 = $.jqplot('chart3', [line1], {
animate: true,
animateReplot: true,
seriesDefaults: {renderer: $.jqplot.BarRenderer},
series:[{
pointLabels:{
show: true,
labels:[depression, anxiety, stress]
},
rendererOptions: {
animation: {
speed: 3500
},
barWidth: 50,
barPadding: -15,
barMargin: 0,
varyBarColor : true,
highlightMouseOver: false
}
}],
axes: {
xaxis: {
renderer:$.jqplot.CategoryAxisRenderer
}
},
canvasOverlay: {
show: true,
objects: [{
horizontalLine: {
y: 42,
lineWidth: 3,
color: 'rgb(255,0,0)',
shadow: true,
xOffset: 0
}
}]
}
});
plot3.replot( { resetAxes: true } );
Run Code Online (Sandbox Code Playgroud)
Gya*_*eep 23
将此添加到您的 axes:
axes: {
xaxis: {
renderer: $.jqplot.CategoryAxisRenderer
},
yaxis: {
min:0,
max:42
}
},
Run Code Online (Sandbox Code Playgroud)
您可以添加tickInterval以指定刻度之间的间隔yaxis
replot在尝试重置轴时,请将这些设置添加到您的功能中:
plot3.replot({axes: {
xaxis: {
renderer: $.jqplot.CategoryAxisRenderer
},
yaxis: {
min:0,
max:42
}
}});
Run Code Online (Sandbox Code Playgroud)
要么
你可以说
plot3.replot(false);
Run Code Online (Sandbox Code Playgroud)
所以它不会重置您的轴.
| 归档时间: |
|
| 查看次数: |
17506 次 |
| 最近记录: |