TypeError: Cannot read property 'forExport' of undefined after calling getSVG() on ChartObject
See original GitHub issueI know there was a similar issue closed on June 18, but I can’t find a solution and am desperate at this point. After calling the getSVG() method on the ChartObject (I’m using Waterfall and Line Charts), I receive an error after trying to navigate to another page. It looks like it’s in the Chart.destroy method.
It looks like Highcharts fixed something in issue 8643 (https://github.com/highcharts/highcharts/issues/8643) and changed what the destroy method returns in 9232 (https://github.com/highcharts/highcharts/issues/9232). The destroy method now returns undefined instead of an empty object.
Could you change the destroy() method in chart.directive.ts to something like this?
private destroy() {
if (this.chart && (this.chart instanceof Chart || this.chart instanceof StockChart || this.chart instanceof MapChart)) {
this.chart = this.chart.destroy();
}
}
I’m using version 7.0.2 of angular-highcharts and 6.2.0 of highcharts and Angular 7. Thank you in advance for your help.
Here is the call stack:
“Error: Uncaught (in promise): TypeError: Cannot read property ‘forExport’ of undefined TypeError: Cannot read property ‘forExport’ of undefined at a.Chart.destroy (http://localhost:49896/vendor.js:78077:439) at Chart.push…/node_modules/angular-highcharts/fesm5/angular-highcharts.js.Chart.destroy (http://localhost:49896/vendor.js:70422:22) at ChartDirective.push…/node_modules/angular-highcharts/fesm5/angular-highcharts.js.ChartDirective.destroy (http://localhost:49896/vendor.js:70620:24) at ChartDirective.push…/node_modules/angular-highcharts/fesm5/angular-highcharts.js.ChartDirective.ngOnDestroy (http://localhost:49896/vendor.js:70599:14) at callProviderLifecycles (http://localhost:49896/vendor.js:53320:18) at callElementProvidersLifecycles (http://localhost:49896/vendor.js:53288:13) at callLifecycleHooksChildrenFirst (http://localhost:49896/vendor.js:53278:29) at destroyView (http://localhost:49896/vendor.js:54340:5) at callViewAction (http://localhost:49896/vendor.js:54466:13) at execEmbeddedViewsAction (http://localhost:49896/vendor.js:54409:17) at resolvePromise (http://localhost:49896/polyfills.js:7152:31) at resolvePromise (http://localhost:49896/polyfills.js:7109:17) at http://localhost:49896/polyfills.js:7211:17 at ZoneDelegate.push…/node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:49896/polyfills.js:6759:31) at Object.onInvokeTask (http://localhost:49896/vendor.js:48511:33) at ZoneDelegate.push…/node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:49896/polyfills.js:6758:36) at Zone.push…/node_modules/zone.js/dist/zone.js.Zone.runTask (http://localhost:49896/polyfills.js:6526:47) at drainMicroTaskQueue (http://localhost:49896/polyfills.js:6933:35) at push…/node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask (http://localhost:49896/polyfills.js:6838:21) at ZoneTask.invoke (http://localhost:49896/polyfills.js:6823:48)”
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (5 by maintainers)
Top GitHub Comments
@cebor Latest version fixed the issue. Thank you very much for the quick fix. Very much appreciated!
I think its fixed, just struggling with these new github actions ^^