我正在使用Highcharts餅圖,我想爲每個點添加自定義後綴。比如現在我有這樣的提示格式化:自定義工具提示名稱餅圖
tooltip : { formatter : function() { return 'Daily KB: <b>'+ this.point.y +'</b>'; } },
,並顯示在彈出的方式是一樣的東西,對於每個分一杯羹Daily KB: 300
的。我如何修改這個,使得在一個彈出框中將會出現這樣的Daily KB: 700 remaining
,另一個將是Daily KB: 300
?
Highcharts script:
(function($){
$(this.document).ready(function(){
//get local time
Highcharts.setOptions({
colors: ['#fa604c', '#00CC66']
});;
myChart_d = new Highcharts.Chart({
chart: {
height:200,
width:200,
type: 'pie',
animation: false,
renderTo: 'dailychart',
zoomType: 'x',
events: {
load: function() {
requestDataLim();
}
}
},
title: {
text: 'Daily'
},
tooltip : {
formatter : function() {
return 'Daily KB: <b>'+ this.point.y +'</b>';
}
},
//tooltip: {
//shared:true
//},
plotOptions: {
pie: {
// allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false,
},
borderColor: '#A0A0A0',
innerSize: '40%',
},
series:{
dataLabels: {
style:{ fontSize: '14px', fontWeight:'bold' },
enabled: true,
formatter: function() {
return Math.round(this.percentage) + ' %';
},
distance: -15,
color:'black'
}
},
},
credits: {
enabled: false
},
series: [{
name: 'DailyKB',
data:
[<?php echo join(',',$d);
echo ',';
echo join (',',$dl);?>]
}],
exporting: {
buttons: {
printButton: {
enabled: false
},
exportButton: {
enabled: false
}
}
}
});
我讓我通過Ajax和JSON數據,目前有這樣的事情[300, 700]
請分享你的整個highcharts腳本。 –