我目前正在使用 Highcharts 包来使用 Highcharts 包动态创建图表。一切都很顺利,直到我决定在 Web 开发人员最好的朋友 IE 上进行测试。惊喜,惊喜,它不喜欢我的代码。下面可以看到我的代码以及我的数据示例,让您了解我正在使用的内容:
<html lang="en">
<head>
<title>Preprocessing Test</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="http://code.highcharts.com/highcharts.js"></script>
<script type="text/javascript" src="http://code.highcharts.com/modules/exporting.js"></script>
<link href="chemistry.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript">
$(document).ready(function() {
var options = {
chart: {
renderTo: 'container',
defaultSeriesType: 'spline',
zoomType: 'x',
},
plotOptions: {
spline: {
lineWidth: 3,
states: {
hover: {
lineWidth: 1
}
},
tooltip: {
backgroundColor: '#FCFFC5',
borderColor: 'black',
borderRadius: 10,
borderWidth: 3
},
marker: {
enabled: false,
states: {
hover: {
enabled: true,
symbol: 'circle',
radius: 2,
lineWidth: 1,
}
}
}
}
},
title: {
text: 'Preprocessed Example'
},
xAxis: {
categories: [],
labels: {
step: 1
},
turboThreshold: 2000,
title: {
text: 'Test'
}
},
yAxis: {
title: {
text: 'Test'
}
},
series: [{
data:[],
name: 'Test'
}]
};
$.getJSON('files/nmr/Trimethylbenzene_test.json', function(data) {
options.series[0].data = data;
var chart = new Highcharts.Chart(options);
});
});
</script>
</head>
<body>
<div style="height: 400px;min-width:300px;" id="container"></div>
</body>
</html>
然后是我的 JSON 文件的几行示例:
[
[-4.16606,-2.535],
[-4.16574,-1.787],
[-4.16543,0.465],
[-4.16511,1.98],
[-4.1648,1.303],
[-4.16449,-0.787],
[-4.16417,-1.571],
[-4.16386,-1.797],
[-4.16354,-2.251],
[-4.16323,-1.614],
[16.40641,-7.857]
]
知道为什么它在 IE 中不起作用吗?