Uncaught TypeError: Cannot read property 'modLayer' of null
See original GitHub issuefunction reloadEcharts(obj, json) {
var chart = echarts.init(obj);
chart.setOption(json);
window.addEventListener("resize", function() {
chart && chart.resize();
});
}
开启chrome 调试台时候,会触发echarts resize 事件,会引起报错,望解惑…
Issue Analytics
- State:
- Created 8 years ago
- Comments:11 (1 by maintainers)
Top Results From Across the Web
Uncaught TypeError: Cannot read property of null - iDiallo
This will result in Uncaught TypeError: Cannot read property 'value' of null . The reason will be that the element with id input...
Read more >Uncaught TypeError: Cannot read property 'modLayer' of null ...
I have the same error. Is there any fix? This happens when I call back a new chart from Ajax, then the resize...
Read more >Uncaught TypeError: Cannot read property of null
Hello im having trouble of fixing this error Uncaught TypeError: Cannot read property '2' of null . This is what i want to...
Read more >Re: TypeError: Cannot read properties of null (rea...
Hello, I'm working with the ArcGIS API for Javascript, @arcgis/core ^4.22 inside an angular (13.1.1) application and encountering an error ...
Read more >Cannot read property 'lat' of null - when 'Edit layer' option is ...
Uncaught TypeError : Cannot read property 'lat' of null at Object.project at Object.latLngToPoint at NewClass.project at NewClass.
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
The problem is based on the new ajax chart, will delete the old one, the system tries to resize the old one, but that no longer exists. One solution is to bind the function to resize and unbind after the new ajax and bind again. But this is also a problem, because the binding is done on unanimous function. So this implementation helped me:
I. define a new modules.js inside the “echarts/module/modules.js”
II. inside the modules.js define a new require dict holding all your charts:
III. In your chart function just call the new module with the require.js:
我也遇到了这个问题。原因应该是:window.onresize上绑定的resize方法所对应的chart对象已经不存在了。 所以在调用echarts.init后也要更新window.onresize对应的resize方法。(如果是用jquery.on绑定resize函数,相应也需要用jquery.off去解除绑定)