首页 新闻 赞助 找找看

highcharts绘制饼图的问题

0
[已解决问题] 解决于 2014-07-01 10:01

这只是一部分代码,我想显示的比例保留两位小数

 

chart3 = new Highcharts.Chart({
chart: {
renderTo: 'container3',
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
colors:[
'#66FF66',
'red',
'black'
],
title: {
text: '运营情况'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage}%</b>',
percentageDecimals: 1
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
color: '#000000',
connectorColor: '#008000',
format: '<b>{point.name}</b>: {point.percentage:.1f} %'
},

}
},
series: [{
type: 'pie',
name: '所占比率',
data: [
['运营', b4_ratio],

['停运', b5_ratio],
['无运营信息',b6_ratio]
]
}]
});

康大头的主页 康大头 | 初学一级 | 园豆:25
提问于:2014-06-23 11:14
< >
分享
最佳答案
0
奖励园豆:5
王那个锋啊 | 菜鸟二级 |园豆:311 | 2014-07-01 01:45
其他回答(2)
0

建议楼主取值的时候,进行数据格式化,用这个方法。Highcharts.numberFormat(你取的值,2),可以试试。

坤坤 | 园豆:919 (小虾三级) | 2014-06-23 11:22
0

tooltip: {
formatter: function() {
var s = '<b>'+ this.x +'</b>';

$.each(this.points, function(i, point) {
s += '<br/>'+ point.series.name +': '+
point.y +'m';
});

return s;
},
shared: true
},

 

你修改下就能实现了

刘宏玺 | 园豆:14020 (专家六级) | 2014-06-23 12:17
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册