在导入exporting.js(导出高图表)时出错'无法读取未定义的属性'文档' [英] Getting error 'Cannot read property 'document' of undefined' while importing exporting.js (to export highchart charts)

查看:254
本文介绍了在导入exporting.js(导出高图表)时出错'无法读取未定义的属性'文档'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正尝试将一张图表导出为一个PDF文件。为此,我读过我应该使用exporting.js(和其他库)。但是当我导入这个库(exporting.js)时,我得到这个错误:'无法读取未定义的属性'文档'。

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'.

我从javascript中导入它:

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!

推荐答案

请验证您是否具有相同版本的exporting.js和highcharts.js模块。它看起来像是指最新的exporting.js,但不是最新的highcharts.js。

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.

这篇关于在导入exporting.js(导出高图表)时出错'无法读取未定义的属性'文档'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆