[英]How to have legends in Pie charts as data labels in HighCharts
I have a couple of questions while dealing with Pie Charts in High charts.在处理高图表中的饼图时,我有几个问题。
my chart options:我的图表选项:
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
}]
}]
});
Would be grateful if I get an answer to any of my questions.如果我得到任何问题的答案,我将不胜感激。
symbolRadius
or symbolHeight
. symbolRadius
或symbolHeight
等选项来自定义图例符号。 Demo: https://jsfiddle.net/BlackLabel/1m98xgvr/演示: https://jsfiddle.net/BlackLabel/1m98xgvr/
API: https://api.highcharts.com/highcharts/legend.symbolHeight API: https://api.highcharts.com/highcharts/legend.symbolHeight
If you want to change the legend symbol to the custom png try to use this solution:如果您想将图例符号更改为自定义 png,请尝试使用此解决方案:
Custom Highcharts legend symbol 自定义Highcharts图例符号
dataLabels.useHTML
flag to true and use the dataLabes.formatter
callback to customize the output which will be an outstanding HTML element.dataLabels.useHTML
标志设置为 true 并使用dataLabes.formatter
回调来自定义 output,这将是一个出色的 HTML 元素。 Demo: https://jsfiddle.net/BlackLabel/2sog3znq/演示: https://jsfiddle.net/BlackLabel/2sog3znq/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.