Javascript 在JQPlot的堆叠条形图中隐藏0值堆叠条形图
我正在使用JQPlot生成堆叠条形图,其中很少有堆栈具有O值。我的要求是,我不想显示该属性值为0的O级别。请让我知道我应该使用什么JQPLOT API 我的代码:Javascript 在JQPlot的堆叠条形图中隐藏0值堆叠条形图,javascript,jqplot,Javascript,Jqplot,我正在使用JQPlot生成堆叠条形图,其中很少有堆栈具有O值。我的要求是,我不想显示该属性值为0的O级别。请让我知道我应该使用什么JQPLOT API 我的代码: function getChart2() { var s1 = [32.40, 80.00, 80.00, 16.94, 72.12, 78.10, 80.00]; var s2 = [0.00, 12.34, 3.68, 0.00, 0.00, 0.00, 15.67]; v
function getChart2()
{
var s1 = [32.40, 80.00, 80.00, 16.94, 72.12, 78.10, 80.00];
var s2 = [0.00, 12.34, 3.68, 0.00, 0.00, 0.00, 15.67];
var ticks = ['A', 'B', 'C', 'D','E','F','G'];
plot3 = $.jqplot('chartdiv', [s1, s2], {
// Tell the plot to stack the bars.
stackSeries: true,
captureRightClick: true,
seriesDefaults:{
renderer:$.jqplot.BarRenderer,
rendererOptions: {
fillToZero: true, barDirection: 'horizontal'
},
pointLabels: {show: true}
},
axes: {
xaxis: {
pad: 1.05,
tickOptions: {formatString: '%.2f %'},
formatter:function() {if(this.x > 0.00) {
return this.x;
} }
},
yaxis: {
renderer: $.jqplot.CategoryAxisRenderer,
ticks: ticks
}
},
legend: {
show: true,
location: 'e',
placement: 'outside'
}
});
}
我使用了hideZeros:true选项,现在可以使用了
点标签:{show:true,hideZeros:true,labelsFromSeries:true,xpadding:6}嘿,伙计们,谢谢你们的帮助 我设法解决了我的问题 我用它来解决我的问题: 斯塔克系列:没错, captureRightClick:true, 系列默认值:{ 渲染器:$.jqplot.blunderer, 渲染器选项:{ highlightMouseDown:没错, 条宽:40, },
pointLabels: {
show: true,
formatString: '%s',
formatter: function val(x, y) {
//my Solution
if (y != 0)
return y.toString().toHHMMSS();
},
},
},
现场或类似的演示会非常有帮助。