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);
}
);
正常に機能していますが、バーラベルの小数点以下の桁数を取り除き、値を最も近い整数に丸めています。これを止めて、結果を小数点以下2桁まで表示するにはどうすればよいですか?試しformatString: "\u00A3\%'d%.2f"
ましたが、ここに到達する前に文字列をフォーマットしているように見えます
私はjqplot.barRenderer.min.js、jqplot.categoryAxisRenderer.min.js、jqplot.pointLabels.min.jsを使用しています