我将 HighCharts 与 Python 一起使用来动态创建图表。一切正常,但是我得到cannot read property "0" of undefined
IE8下例外。不幸的是我的客户希望它也能在 IE8 下工作。所以这是 main 函数的代码:
function generateChart(series) {
var chart = new Highcharts.Chart({
chart: {
renderTo: 'company_chart',
},
xAxis: {
type: "datetime",
},
yAxis: [{
title: {
text: "T1",
},
},{
title: {
text: "T2",
},
},
opposite: true,
}],
plotOptions: {
series: { shadow: false },
column: { shadow: false, },
},
series: series
});
);
现在我的 ajax 请求返回一些数据,并将其存储在变量中,如下所示:
chart_data = [
{
type: "spline",
color: '#ff0000',
yAxis: 0,
data: dataT1,
},
{
type: "column",
color: '#0000ff',
yAxis: 1,
data: dataT2,
}
];
之后我打电话generateChart(chart_data);
。变量的格式dataT1
and dataT2
很好,因为它可以在所有其他浏览器下运行。例如dataT1
可能看起来像这样:
dataT1 = [ [1325721600000,1.64],
[1325635200000,1.64],
[1325548800000,1.7],
[1325462400000,1.7],];
但在IE8下仍然抛出异常。任何想法如何解决这一问题?