highcharts-angular
highcharts-angular copied to clipboard
Cannot read properties of undefined (reading 'forExport')
Describe the bug
Hi, We are using offline export of highcharts, after exporting chart to any format whenever we route to another component we face subject mentioned exception in console. Updating highcharts is not an option for us now. Other solutions mentioned in this forum for same issue dont seem to work either. I have tried recreating the roblem in stablitz link below, i am updating chart object to null manually to recreate the issue and console will through same error.
Expected behavior
There shouldnt be any problem in destroying the chart component after export.
Demo
https://stackblitz.com/edit/angular-highcharts-events-example-qbrmy2?file=app/hello.component.ts
Steps required to recreate the problem in the demo:
- ... Open the stackblitz url, Click on Lets create custom chart click export, open for a few seconds and wait for an alert to appear. after alert i have updated the chart variable to null to trigger destroy of chart. which throws the error.
Setup used
- NodeJS version ...14.18
- Angular version ...11 Highcharts 7 "highcharts-angular": "2.10.0",
Anybody?
Hi @GurlWhoCodesAlot!
When you are trying to export the chart, a new mock chart is created.
This extra new chart is flagged with forExport
flag. Richt after the chart is exported this mock chart is destroyed.
Could you please explain why are you trying to do the same manually?
if (!this.renderer.forExport) {
} else {
setTimeout(() => {
alert('load called for exportsssed chart');
console.log(this, c);
c.destroy();
objRef.createCustomChart(opts);
}, 5000);
}
Closing due to inactivity.