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 - when using exporting module

See original GitHub issue

Hi everybody, I use the latest version of the angular-highcharts module. Everything’s going well so far. However, I get an error as soon as I have used the export function for a diagram and then change the route ( I use the angular router).

ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'forExport' of undefined TypeError: Cannot read property 'forExport' of undefined at a.Chart.destroy (highcharts.js:264) at ChartDirective.push../node_modules/angular-highcharts/angular-highcharts.es5.js.ChartDirective.destroy (angular-highcharts.es5.js:345) at ChartDirective.push../node_modules/angular-highcharts/angular-highcharts.es5.js.ChartDirective.ngOnDestroy (angular-highcharts.es5.js:302) at callProviderLifecycles (core.js:9268) at callElementProvidersLifecycles (core.js:9236) at callLifecycleHooksChildrenFirst (core.js:9226) at destroyView (core.js:10288) at callViewAction (core.js:10414) at execEmbeddedViewsAction (core.js:10357) at destroyView (core.js:10286) at a.Chart.destroy (highcharts.js:264) at ChartDirective.push../node_modules/angular-highcharts/angular-highcharts.es5.js.ChartDirective.destroy (angular-highcharts.es5.js:345) at ChartDirective.push../node_modules/angular-highcharts/angular-highcharts.es5.js.ChartDirective.ngOnDestroy (angular-highcharts.es5.js:302) at callProviderLifecycles (core.js:9268) at callElementProvidersLifecycles (core.js:9236) at callLifecycleHooksChildrenFirst (core.js:9226) at destroyView (core.js:10288) at callViewAction (core.js:10414) at execEmbeddedViewsAction (core.js:10357) at destroyView (core.js:10286) at resolvePromise (zone.js:814) at resolvePromise (zone.js:771) at zone.js:873 at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421) at Object.onInvokeTask (core.js:3662) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420) at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188) at drainMicroTaskQueue (zone.js:595) at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:500) at invokeTask (zone.js:1540)

This only happens if I use the export function (no matter if JPG, PDF, PNG or PDF) and then change the route. If I change the route without using the export function, it does not happen.

I think something’s wrong with deleting the export copy.

My import in app.module.ts looks like this: import highstock from 'highcharts/modules/stock.src'; import exporting from 'highcharts/modules/exporting.src'; import offlineExporting from 'highcharts/modules/offline-exporting.src'; [...] export function highchartsModules() { return [ highstock, exporting, offlineExporting ]; } [...] @NgModule({ [...] providers: [ { provide: HIGHCHARTS_MODULES, useFactory: highchartsModules } ] [...]

  • angular: 6.0.4
  • angular-highcharts: 6.1.5
  • highcharts: 6.1.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jeffaxialcommented, Jun 18, 2018

What did it fix? I’m still seeing all of the same errors.

0reactions
harshit-gitcommented, Dec 24, 2022

Did anybody here find the solution?

I am facing same issue when routing with svelte. Destroy function along with export module seems to be the culprit here. Need solution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'forExport' of undefined when leaving ...
angular - Cannot read property 'forExport' of undefined when leaving the page with Hicharts chart - Stack Overflow. Stack Overflow for Teams – ......
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]-Changing chart type give: Uncaught TypeError
Coding example for the question Changing chart type give: Uncaught TypeError: Cannot read property 'length' of undefined Highcharts-Highcharts.
Read more >
Forge Macro Export release
We're excited to announce that the Forge export macro is available ... an error because it is undefined: TypeError: Cannot read property '....
Read more >
Exporting Charts – amCharts 4 Documentation
Besides listed menu item properties, you can also set options for the format, using options key: TypeScript / ES6 JavaScript. JSON ... chart.exporting.menu....
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