如何解决错误无法使用amcharts4的exportmenu.draw读取null的属性推送?

时间:2019-05-11 18:33:38

标签: amcharts amcharts4

我们将在一页中加载amcharts4 mapcharts,折线图和饼图以及大量数据。
如果页面地图的加载不正确,并且在浏览器控制台中,则会引发大量控制台错误。

这里有错误

strides = 4

当我们尝试注释掉图表组件中的以下线条时,它不会抛出错误,但是会丢失导出功能

zone.js:199 Uncaught TypeError: Cannot read property 'push' of null
    at ExportMenu.push../node_modules/@amcharts/amcharts4/.internal/core/export/ExportMenu.js.ExportMenu.draw (ExportMenu.js:209)
    at ExportMenu.push../node_modules/@amcharts/amcharts4/.internal/core/export/ExportMenu.js.ExportMenu.validate (ExportMenu.js:171)
    at Object.dispatch (EventDispatcher.js:381)
    at EventDispatcher.js:266
    at Module.each (Array.js:74)
    at EventDispatcher.push../node_modules/@amcharts/amcharts4/.internal/core/utils/EventDispatcher.js.EventDispatcher._eachListener (EventDispatcher.js:239)
    at EventDispatcher.push../node_modules/@amcharts/amcharts4/.internal/core/utils/EventDispatcher.js.EventDispatcher.dispatchImmediately (EventDispatcher.js:264)
    at Registry.push../node_modules/@amcharts/amcharts4/.internal/core/Registry.js.Registry.dispatchImmediately (Registry.js:209)
    at System.push../node_modules/@amcharts/amcharts4/.internal/core/System.js.System.update (System.js:299)
    at System.js:343

那么导致这些错误的原因是什么,如何解决这些错误并保持导出功能呢?

1 个答案:

答案 0 :(得分:0)

在amCharts 4版本4.7.5之前,我一直遇到相同的错误,在撰写本文时,我已更新至版本4.7.12,此问题已解决。

我的建议是,从2019年12月5日开始,使用最新版本的amCharts即4.7.12升级package.json文件,这将解决您的问题。