[英]Getting error 'Cannot read property 'document' of undefined' while importing exporting.js (to export highchart charts)
I'm trying to export a highchart charts to a PDF file. 我正在尝试将海图图表导出为PDF文件。 For that, I've read that I should use exporting.js (and others libraries). 为此,我读到我应该使用exporting.js(和其他库)。 But when I import this library (exporting.js) I get this error: 'Cannot read property 'document' of undefined'. 但是,当我导入该库(exporting.js)时,出现以下错误:“无法读取未定义的属性'document'”。
I import this from a javascript: 我从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! 我将不胜感激!
Please verify if you have the same version of exporting.js and highcharts.js module. 请验证您是否具有相同版本的exporting.js和highcharts.js模块。 It looks like you refer to the newest exporting.js but not up-to-date highcharts.js. 看起来您引用的是最新的exporting.js,而不是最新的highcharts.js。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.