1
我還沒有看到其他人嘗試這樣做。我基本上有一組數據用於我的「系列」集合中的餅圖,但是在傳說中,而不是將這些貨幣值分出來,我想對它們進行「分類」。我認爲我之前通過在完整事件中完成點名稱的「傳說」更新,但現在似乎還在更改數據標籤名稱。這裏是我的小提琴/代碼:具有不同「名稱」的圖例和數據標籤
http://jsfiddle.net/Lyuo4f9g/1/
$(function() {
var chart;
$('#pie_chart').highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: null
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
showInLegend: true,
dataLabels: {
enabled: true,
defer: false,
format: '<b>{point.name}</b>: {point.percentage:.1f} %',
style: {
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
}
}
}
},
colors: ['#77AEFF', '#94D664', '#E3DE51', '#D69567', '#D66664', '#aaaaab', '#a89375'],
legend: {
enabled: true
},
series: [{
type: 'pie',
data: [
['$64,351.70', 90.0], {
name: '$4,580.37',
y: 6.0,
sliced: true,
selected: true
}, ['$742.31', 1.0],
['$1231.43', 2.0],
['499.97', 1.0],
['$74.54', 0.0],
['$32.35', 0.0],
]
}]
}, function (chart) { // on complete
$(document).ready(function() {
chart.legend.allItems[0].update({
name: 'Current'
});
chart.legend.allItems[1].update({
name: '31-60'
});
chart.legend.allItems[2].update({
name: '61-90'
});
chart.legend.allItems[3].update({
name: '91-120'
});
chart.legend.allItems[4].update({
name: '121-150'
});
chart.legend.allItems[5].update({
name: '151-180'
});
chart.legend.allItems[6].update({
name: 'Over 180'
});
});
});
});
我基本上想要datalabels顯示貨幣值(即$ ##。##)和百分比。但傳說繼續顯示「當前,31-60等」
有什麼建議嗎?