我正在尝试在 IE9 中运行这个 Highcharts 示例
http://www.highcharts.com/studies/live-server.htm
但我没有调用 php 脚本,而是执行以下操作:
function requestData() {
var MyAppUrlSettings = {
MyUsefulUrl: '/PaymentConfirmation/UpdateChart?numSecondsToGoBack=3600'
}
$.ajax({
url: MyAppUrlSettings.MyUsefulUrl,
type: "POST",
async: false,
dataType: "json",
success: function (PaymentConfirmationData) {
$.each(PaymentConfirmationData, function (i, PaymentConfirmation) {
var d = new Date();
d.setTime(parseInt(PaymentConfirmation.TimeMilliSeconds));
var milli = d.getTime();
var series = chart.series[0],
shift = series.data.length > 20; // shift if the series is longer than 20
// add the point
chart.series[0].addPoint([milli, PaymentConfirmation.Count], true, shift);
// call it again after one second
setTimeout(requestData, 1000);
});
},
error: function (xhr, status, error) {
alert("An AJAX error occured: " + status + "\nError: " + error);
},
cache: false
});
}
现在就像在示例中一样,图表对象是全局声明的(我认为这在某种程度上不起作用!!!)
注意:“$(document).ready(function() {”函数与示例中的一样。
请提前提供帮助和感谢。