Как исправить ошибки Не удается прочитать свойство push of null с помощью exportmenu.draw of amcharts4? - PullRequest
1 голос
/ 11 мая 2019

На одной странице мы загружаем amcharts4 mapcharts, линейные диаграммы и круговые диаграммы и с тяжелыми данными.
Когда загрузка карт страниц диаграммы не загружается должным образом и в консоли браузера выдает кучу ошибок консоли.

Здесь ошибки

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

Когда мы попытались закомментировать приведенные ниже строки в компонентах диаграмм, это не приводит к ошибкам, но теряет функциональность экспорта

if (chartConfig.export && chartConfig.export.enabled) {
      newChart.exporting.menu = new am4core.ExportMenu();
      newChart.exporting.menu.verticalAlign = chartConfig.export.valign as am4core.VerticalCenter;
      newChart.exporting.menu.align = chartConfig.export.halign as am4core.Align;
}

и чтовызывая эти ошибки и как я могу исправить эти ошибки, и сохраняя функциональность экспорта?

...