question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Cannot read property 'forExport' of undefined after calling getSVG() on ChartObject

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
AntiAskocommented, Apr 16, 2020

@cebor Latest version fixed the issue. Thank you very much for the quick fix. Very much appreciated!

1reaction
ceborcommented, Apr 15, 2020

I think its fixed, just struggling with these new github actions ^^

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'forExport' of undefined when leaving ...
I tried to delete the chart in ngOnDestroy() , or to unsubscribe - but no difference. Here is the repo, including Server-side code....
Read more >
Cannot read property 'forExport' of undefined - Highcharts
Hello, This message started showing up recently, when I introduced secondary chart , which I have to destroy periodically.
Read more >
[Solved]-Highcharts-ng stock chart gives "TypeError
[Solved]-Highcharts-ng stock chart gives "TypeError: Cannot read property 'hoverSeries' of undefined" when loading data asynchronously-Highcharts. Search.
Read more >
Incident Response - Hybrid Analysis
Analysed 3 processes in total. rundll32.exe "%WINDIR%\System32\ieframe.dll",OpenURL C:\bd04f6b8121f77fa8556a75d06df44dcfd4c6b7e7e1aec7047f484a22b88666a.url (PID ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found