如何删除图表上显示的图例,并将图例保留在图表的底部?
Highcharts.chart('operatingSystemReleaseChart', {
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie',
margin: [0, 0, 40, 0],
spacingTop: 0,
spacingBottom: 0,
spacingLeft: 0,
spacingRight: 0,
},
credits: {
enabled: false
},
exporting: {
enabled: false
},
title: {
text: ""
},
tooltip: {
shared: false,
borderRadius: 3,
borderWidth: 0,
shadow: false,
enabled: true,
backgroundColor: 'none',
useHTML: true,
formatter: function () {
return '<div class="tooltipHC"><div>'+this.point.name+'</div>' +
'<div>Total:<b class="pull-right">'+this.y+'</b></div>' +
'<div>Total(%):<b class="pull-right">'+Highcharts.numberFormat(this.percentage)+' %</b></div></div>';
}
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
size: "100%",
dataLabels: {
enabled: true,
},
showInLegend: true,
borderWidth: 0
}
},
series: [{
name: 'Total',
colorByPoint: true,
data: arrayForPieChart
}]
});
答案 0 :(得分:2)
在plotOptions.pie
中,确保dataLabels
属性enabled
设置为false
。
以下是一个示例 - https://codepen.io/Inlesco/pen/EXLPVb