Search code examples
highchartshighcharts-ng

Highcharts 5: TypeError: Cannot read property 'chart' of undefined at e.Chart.reflow


I recently upgraded from

"highcharts-ng": "~0.0.11",
"highcharts-release": "~4.1.9",
"angular-bootstrap": "~0.14.3",

to

"highcharts-ng": "~1.1.0",
"highcharts-release": "~5.0.11",
"angular-bootstrap": "~0.14.3",

and only since then get this problem: I have a single page angular application (Angular 1.5.8) using Bootstrap UI (not sure if that matters). The problem does not exist with highcharts 4 and highcharts-ng 0.0.11.

When I have a page with a highchart directive <highchart class="highchart-hover" config="chart"></highchart> in it and I leave this page by navigating to another page/ route, I see this error in the Chrome developer console:

TypeError: Cannot read property 'chart' of undefined
    at e.Chart.reflow (script.js:40411)
    at script.js:40661
    at script.js:25025
    at i (script.js:11128)
    at script.js:11407
    at nrWrapper ((index):43)

Following the stack trace, I see the sources as follows:

As mentioned, with the older highcharts/highcharts-ng version, this problem did not exist. Any idea what might cause this? I guess there is a check missing whether the chart object actually still exists.

Thanks.

(Unfortunately I don't have a jsfiddle at hand right now for this.)


Solution

  • Problem is with the highcharts-ng library and I filed an issue report here: https://github.com/pablojim/highcharts-ng/issues/594

    Also see the comments there for a workaround.