【发布时间】:2023-03-25 09:32:01
【问题描述】:
我正在使用 JQPlot 生成堆积条形图,其中很少有堆栈可能具有 O 值。我的要求是我不想显示该统计数据的 O 级别,其值为 0。请让我知道我应该使用什么 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];
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'
}
});
}
【问题讨论】:
-
现场直播JS Fiddle 或类似的演示会非常有帮助。
标签: javascript jqplot