Thanks for your reply.
I have kind of figured out what is the reason why I get this error.
It is because of the fact that I use function that adjust chart labels font size (depending on chart areas size) on "afterAnimate" event.
When I stop using this function, chart is properly exported.
Do you have any idea what to do to preserve this function and also make it errorless?
Code: Select all
private adjustLabelsFontSizes = function (this: Highcharts.Series) {
this.points.forEach((point) => {
if (point?.percentage) {
let fontSize = 28;
if (point?.percentage < 20) {
fontSize = 22;
}
if (point?.percentage < 15) {
fontSize = 18;
}
if (point?.percentage < 10) {
fontSize = 15;
}
if (point?.percentage < 6) {
fontSize = 13;
}
point.update({
dataLabels: {
style: {
fontSize: `${fontSize}px`,
color: 'contrast',
},
},
});
}
});
};
Code: Select all
private generateSeries(
banknotesAndCoinsSeriesConfig: CirculationSeriesConfig[],
circulationData: CirculationPieChartSeriesData,
config?: { center?: [string | number, string | number]; isDonut?: boolean }
): Highcharts.SeriesOptionsType {
return config?.center
? {
type: 'pie',
events: {
afterAnimate: this.adjustLabelsFontSizes,
},
center: config.center,
data: banknotesAndCoinsSeriesConfig.map((series) => ({
name: this.translateService.instant('banknotes_and_coins_page.circulation.series_names.' + series.key),
y: circulationData[series.key]!,
color: series.color,
})),
}
: {
type: 'pie',
events: {
afterAnimate: this.adjustLabelsFontSizes,
},
innerSize: config?.isDonut ? '30%' : '0',
data: banknotesAndCoinsSeriesConfig.map((series) => ({
name: this.translateService.instant('banknotes_and_coins_page.circulation.series_names.' + series.key),
y: circulationData[series.key]!,
color: series.color,
})),
};
}