【发布时间】:2019-04-18 21:46:18
【问题描述】:
我正在使用 jqplot.PieRenderer 并且需要我的百分比四舍五入到小数点后 2 位。我已将文本标签格式化为包含 ADA 合规性的百分比,因此用户不仅仅依赖图例中与百分比匹配的颜色。但是,我的条形图正在四舍五入为整数。
目前的代码是:
$(document).ready(function(){
var data = [ OMMITTED_PII_IN_CODE ];
var plot1 = jQuery.jqplot ('chart1', [data],
{
seriesDefaults: {
// Make this a pie chart.
renderer: jQuery.jqplot.PieRenderer,
rendererOptions: {
// Put data labels on the pie slices.
// By default, labels show the percentage of the slice.
showDataLabels: true
}
},
legend: {
show:true,
location: 's',
border: '0px',
fontSize: '12px',
// Breaks the ledgend into horizontal.
rendererOptions: {
numberRows: '4',
numberColumns: '3'
}
}
,
series: [{color:"#000000"}],
seriesColors: ["#d1ded4","#b8c8bb","#7a9f83","#F4D03F","#337ab7","#ccc","#fcf8e3","#f2dede"],
title: {
text: 'WVSOM Contributions Breakdown'
}
}
); // end plot chart
}); // end document ready
【问题讨论】:
标签: jqplot