Getting error 'Cannot read property 'document' of undefined' while importing exporting.js (to export highchart charts)

我与影子孤独终老i 提交于 2020-01-04 05:44:40

问题


I'm trying to export a highchart charts to a PDF file. For that, I've read that I should use exporting.js (and others libraries). But when I import this library (exporting.js) I get this error: 'Cannot read property 'document' of undefined'.

I import this from a javascript:

var newscript = document.createElement('script');
newscript.type = 'text/javascript';
newscript.async = true;
newscript.src = '/resources/tda-ga/js/charts/lib/exporting.js';
(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(newscript);

I will appreciate any help!


回答1:


Please verify if you have the same version of exporting.js and highcharts.js module. It looks like you refer to the newest exporting.js but not up-to-date highcharts.js.



来源:https://stackoverflow.com/questions/34747535/getting-error-cannot-read-property-document-of-undefined-while-importing-exp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!