【发布时间】:2014-10-15 14:27:26
【问题描述】:
直截了当,我正在下载图表的 PDF,在浏览器控制台上出现上述异常“未捕获的类型错误:无法读取未定义的属性 '0'”。
不知道为什么我会收到此错误。我还有其他下载良好的报告。但有时我会遇到这个问题。我正在运行的一段代码如下。
我正是在window[theSelectedChart].exportChart({这一行遇到了问题
谁能帮帮我。提前致谢。
if(theSelectedChart == 'somechart') {
if(Shortform.chartType == 'bubble'){
var maxDays = Math.max.apply(Math, Shortform.activeDays);
var minDays = Math.min.apply(Math, Shortform.activeDays);
window[theSelectedChart].xAxis[0].setExtremes(minDays - 1, maxDays + 1);
} else {
window[theSelectedChart].xAxis[0].setExtremes(0, categoriesLength);
}
} else {
window[theSelectedChart].xAxis[0].setExtremes(0, categoriesLength - 1);
}
window[theSelectedChart].exportChart({
type: "application/pdf",
url: 'export-chart/',
filename: localizedShortformExportFilenames[key],
sourceWidth:(categoriesLength * 12 > 600) ? categoriesLength * 12 : 800,
},{
scrollbar : {
enabled : false,
},
chart : {
marginTop : getMarginTop(selectedThumbnail),
spacingRight : 30,
},
title: {
y:5,
},
subtitle : {
y : 15
},
});
【问题讨论】:
-
看起来
xAxis可能不存在。您应该尝试使用console.logs 和断点来调试您的代码。 -
或者
localizedShortformExportFilenames可能是未定义的。我们很难知道你给了我们什么。 -
即使在删除了您所指向的语句之后,也失败了。不知道哪里出了问题……我有点紧张……
-
没有足够的信息直接回答(我们只能猜测)根据错误是什么问题。在 Chrome 开发工具中,您可以跟踪(通过单击错误左侧的箭头)调用以引发该异常的函数堆栈。你能附上这样的信息吗?就像here。
标签: javascript jquery highcharts