Uncaught TypeError: Cannot read property 'chart' of undefined
See original GitHub issueFirst of all, really nice job for wrapping highcharts as a react component, exactly what I’ve been looking for!
Following the instruction, I was able to get it up and run pretty easily. Everything works as expected, except the browser keeps throwing the following error whenever page reflows.
Uncaught TypeError: Cannot read property 'chart' of undefined
hb.reflow @highcharts.js:222
(anonymous function) @ReactHighcharts.js:1
Although it doesn’t seem to cause any real problem (the charts redraw without issue), I’d love to see a way to workaround the error. Here is the code for reference, which is pretty much the bare minimal for showing a line chart.
import React, {Component} from 'react';
import ReactHighcharts from 'react-highcharts';
export default class HighchartLine extends Component {
constructor(props) {
super(props);
}
render() {
const config = {
...... // skipping the detail here for saving space
};
return (<ReactHighcharts config = {config} />);
}
}
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:16 (8 by maintainers)
Top Results From Across the Web
Highcharts 5: TypeError: Cannot read property 'chart' of ...
Problem is with the highcharts-ng library and I filed an issue report here: https://github.com/pablojim/highcharts-ng/issues/594.
Read more >Cannot read property 'chart' of undefined - Highcharts
Everthing about the chart functions as it should except this error keeps getting thrown. I am recreating the chart on window resize and...
Read more >TypeError: Cannot read property 'chart' of undefined at e.Chart ...
In line 57, I added a check ctrl!==undefined but the code still tries to execute the reflow , so at that point, ctrl...
Read more >Chart.js: Uncaught TypeError: Cannot read property &#039
This problem is not caused by our product. There's something wrong with Charts or Moment libraries, that the moment is undefined error is...
Read more >Cannot read property 'chart' of undefined"-Highcharts
[Solved]-Vue Highcharts "TypeError: Cannot read property 'chart' of undefined"-Highcharts ... import Highcharts from 'highcharts';. You are using a named import.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We have a similar issue. For us it happens because the reflow-call inside
requestAnimationFrame
happens aftercomponentWillUnmount
, so checking if the chart still exists in the callback might be a good idea.What triggers this in our case is that it mounts->unmounts->mounts quickly. If that is an error on our part I’m currently figuring out.
Yay it works perfectly now! Thanks a lot!