我正在使用jqplot展示一张条形图,其中包括以下内容:
$.jqplot.config.enablePlugins = true;
var s1 = [8916.55, 1860.45, 60.33];
var ticks = ['Total Cost', 'Total Chargeable', 'Total Invoiced'];
plot1 = $.jqplot('chart_div', [s1], {
// Only animate if we're not using excanvas (not in IE 7 or IE 8)..
seriesColors: ["#009DDE", "lightgreen", "green"],
animate: !$.jqplot.use_excanvas,
seriesDefaults:{
renderer:$.jqplot.BarRenderer,
pointLabels: { show: true },
rendererOptions:{
varyBarColor : true,
animation: {
speed: 1000
}
}
},
axes: {
xaxis: {
renderer: $.jqplot.CategoryAxisRenderer,
ticks: ticks
},
yaxis: {
tickOptions:{
formatString: "\u00A3\%'d"
}
}
},
highlighter: {
show: false
},
});
$('#chart1').bind('jqplotDataClick',
function (ev, seriesIndex, pointIndex, data) {
$('#info1').html('series: '+seriesIndex+', point: '+pointIndex+', data: '+data);
}
);
它目前可以正常工作,但是在柱状图标签上去掉了小数位并将值舍入到最近的整数。我该如何停止这种情况并显示正确的两位小数结果?我尝试使用formatString: "\u00A3\%'d%.2f"
,但似乎是在此之前格式化字符串。
我正在使用jqplot.barRenderer.min.js、jqplot.categoryAxisRenderer.min.js和jqplot.pointLabels.min.js。