I work with hightcharts for a while and it is amazing library. But I am stuck with legend in Pie chart. Legend is always displaying like floating, but i need legend under pie.
I got this:-/
I want this:D
My definition is:
Highcharts.chart('container', {
"chart": {
"margin": 0,
"type": "pie",
"height": 300,
"backgroundColor": "#FDFDFD",
"width": 250
},
"legend": {
"floating": false,
"align": "center",
"verticalAlign": "bottom",
},
"plotOptions": {
"pie": {
"dataLabels": {
"enabled": false,
},
"size": "100%",
"showInLegend": true,
}
},
"title": false,
"exporting": false,
"series": [{
"data": [1, 2, 3, 4, 3, 2, 1]
}],
});
The problem is in margin . Set margin to null, or remove this line and it will be fixed.
Highcharts.chart('container', {
"chart": {
"margin": null,
},...
});
Bonus tip: floating of legend is disabled by default, you can remove this line too.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.