JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://code.highcharts.com/highcharts.js"></script>
<div id="container1" style="width: 200px; height: 200px; margin: 0 auto 20px auto"></div>
<div id="container2" style="width: 200px; height: 200px; margin: 0 auto"></div>
CSS
.highcharts-legend-item rect{y:3;}
JavaScript
$("document").ready(
function(){
$('#container1').highcharts({
chart:{
type:'pie',
},
credits:{enabled: false},
title:{text: null},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
showInLegend: true,
dataLabels: {
enabled: false,
formatter: function() {
return this.percentage.toFixed(2) + '%';
}
}
}
},
legend: {
enabled: true,
y:20,
},
series: [{
type: 'pie',
dataLabels: {
},
data: [
['Label 1', 38.5],
['Label 2', 26.85],
]
}]
});
});
$("document").ready(
function(){
$('#container2').highcharts({
chart:{
type:'pie',
},
credits:{enabled: false},
title:{text: null},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
showInLegend: true,
dataLabels: {
enabled: false,
formatter: function() {
return this.percentage.toFixed(2) + '%';
}
}
}
},
legend: {
enabled: true,
y:30,
},
series: [{
type: 'pie',
dataLabels: {
},
data: [
['Label 3', 38.5],
['Label 4', 26.85],
]
}]
});
});