[英]How to have legends in Pie charts as data labels in HighCharts
在處理高圖表中的餅圖時,我有幾個問題。
我的圖表選項:
Highcharts.chart('container', {
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
accessibility: {
point: {
valueSuffix: '%'
}
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '{point.percentage:.1f} %'
},
showInLegend: true
},
},
series: [{
name: 'Brands',
colorByPoint: true,
dataLabels: {
connectorWidth : 0
},
showLegends: true,
data: [{
name: 'Chrome',
y: 61.41,
}, {
name: 'Internet Explorer',
y: 11.84
}, {
name: 'Firefox',
y: 10.85
}]
}]
});
如果我得到任何問題的答案,我將不勝感激。
symbolRadius
或symbolHeight
等選項來自定義圖例符號。演示: https://jsfiddle.net/BlackLabel/1m98xgvr/
API: https://api.highcharts.com/highcharts/legend.symbolHeight
如果您想將圖例符號更改為自定義 png,請嘗試使用此解決方案:
dataLabels.useHTML
標志設置為 true 並使用dataLabes.formatter
回調來自定義 output,這將是一個出色的 HTML 元素。演示: https://jsfiddle.net/BlackLabel/2sog3znq/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.