Я недавно нашел решение, которое показывает мне pieCharts отзывчиво.Он также работает с ReactHighcharts.Единственное, что вам нужно изменить:
From: Highcharts.seriesTypes.pie.prototype.getCenter
To: ReactHighcharts.Highcharts.seriesTypes.pie.prototype.getCenter
Я надеюсь, что смогу помочь другим людям с той же проблемой.
Вот пример решения кода:
Highcharts.seriesTypes.pie.prototype.getCenter = function () {
var allPies = this.chart.series.filter(function (s) {
return s.type === 'pie';
}),
count = allPies.length,
index = allPies.indexOf(this),
plotWidth = this.chart.plotWidth,
plotHeight = this.chart.plotHeight,
smallestSize = Math.min(plotWidth / count, plotHeight);
return [(plotWidth / count) * (index + 0.5) , plotHeight / 2, smallestSize, 0]
};
var chart = Highcharts.chart('container', {
chart: {
type: 'pie',
plotBorderWidth: 1
},
title: {
text: 'Group Name'
},
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
name: 'foo'
}, {
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
name: 'bar'
}, {
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
name: 'bar'
}, {
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
name: 'bar'
}],
plotOptions: {
pie: {
dataLabels: {
enabled: false
}
}
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/highcharts/6.0.7/highcharts.js"></script>
<div id="container" style="height: 300px"></div>