flot饼图默认以百分比显示项目标签,但我需要显示组成百分比的数字而不是百分比。以下是我的数据和代码:
var pieOptions={
series: {
pie: {
show: true,
radius: 1,
label: {
show: true,
radius: 3/4,
formatter: labelFormatter,
background: {
opacity: 0.5,
color: '#000'
}
}
}
},
grid: {
hoverable: true,
clickable: true
},
legend: {
container: '#pieLegend'
}
}
标签格式化程序
function labelFormatter(label, series) {
return "<div style='font-size:8pt; text-align:center; padding:2px; color:white;'>"
+ label + "<br/>" + Math.round(series.percent) + "%</div>";
}
我的数据
[["ebbok1","1"],["ebook2","4"],["ebook3","4"],["something","3"]]
我需要在饼图上显示1、4、4、3,而不是计算出的百分比。
编辑:
我刚尝试了"series.data[0][1]",但在图表中显示为空白。