[英]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.