Javascript Highchart脱机导出尝试从联机cdn加载LIB,但出现错误
我正在对high chart使用脱机导出,并包含以下脚本:Javascript Highchart脱机导出尝试从联机cdn加载LIB,但出现错误,javascript,charts,highcharts,Javascript,Charts,Highcharts,我正在对high chart使用脱机导出,并包含以下脚本: <script src="Scripts/highcharts/5.0.14/highcharts.js"></script> <script src="Scripts/highcharts/5.0.14/highcharts-more.js"></script> <script src="Scripts/highcharts/5.0.14/modules/exporting.
<script src="Scripts/highcharts/5.0.14/highcharts.js"></script>
<script src="Scripts/highcharts/5.0.14/highcharts-more.js"></script>
<script src="Scripts/highcharts/5.0.14/modules/exporting.js"></script>
<script src="Scripts/highcharts/5.0.14/modules/offline-exporting.js"></script>
<script src="Scripts/highcharts/5.0.14/modules/export-data.js"></script>
我在java脚本中还包括了以下选项
Highcharts.getSVG = function (charts, options, callback) {
var svgArr = [],
top = 0,
width = 0,
addSVG = function (svgres) {
// Grab width/height from exported chart
var svgWidth = +svgres.match(
/^<svg[^>]*width\s*=\s*\"?(\d+)\"?[^>]*>/
)[1],
svgHeight = +svgres.match(
/^<svg[^>]*height\s*=\s*\"?(\d+)\"?[^>]*>/
)[1],
// Offset the position of this chart in the final SVG
svg = svgres.replace('<svg', '<g transform="translate(0,' + top + ')" ');
svg = svg.replace('</svg>', '</g>');
top += svgHeight;
width = Math.max(width, svgWidth);
svgArr.push(svg);
},
exportChart = function (i) {
if (i === charts.length) {
return callback('<svg height="' + top + '" width="' + width +
'" version="1.1" xmlns="http://www.w3.org/2000/svg">' + svgArr.join('') + '</svg>');
}
charts[i].getSVGForLocalExport(options, {}, function () {
console.log("Failed to get SVG");
}, function (svg) {
addSVG(svg);
return exportChart(i + 1); // Export next only when this SVG is received
});
};
exportChart(0);
};
/**
* Create a global exportCharts method that takes an array of charts as an argument,
* and exporting options as the second argument
*/
Highcharts.exportCharts = function (charts, options) {
options = Highcharts.merge(Highcharts.getOptions().exporting, options);
// Get SVG asynchronously and then download the resulting SVG
Highcharts.getSVG(charts, options, function (svg) {
Highcharts.downloadSVGLocal(svg, options, function () {
console.log("Failed to export on client side");
});
});
};
// Set global default options for all charts
Highcharts.setOptions({
exporting: {
fallbackToExportServer: false // Ensure the export happens on the client side or not at all
}
});
Highcharts.getSVG=函数(图表、选项、回调){
var svgArr=[],
top=0,
宽度=0,
addSVG=函数(svgres){
//从导出的图表中获取宽度/高度
var svgWidth=+svgres.match(
/^]*宽度\s*=\s*\“?(\d+\”?[^>]*>/
)[1],
svgHeight=+svgres.match(
/^]*高度\s*=\s*\“?(\d+)\”?[^>]*>/
)[1],
//偏移此图表在最终SVG中的位置
svg=svgres.replace(“我认为应该将libURL选项设置为附加lib所在的本地路径
@Derek,你的意思是在问号中吗?@Derek,如果你指向Highcharts.getSVG=function(charts,options,callback){..部分,它在一个单独的js文件中。@Derek,我的错,修复了..问题仍然存在吗?