Ajax正在返回將分配給高圖列的值,但根據我下面的代碼,圖表沒有定義。首先,我試圖創建一個用戶定義函數調用AJAX內的功能並沒有給予適當的更新的話,我已經把optiion變量,並呼籲從這個即使壽未創建高圖柱形圖動態更新ajax
低於對象是代碼:
下面<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>C2S Success %</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<body class="theme-light">
<font color="WHITE">
<marquee behavior="scroll" direction="left" style="background:RED">Testing Etopup Dashboard </marquee>
</font>
<script type="text/javascript">
var options = {
chart: {
renderTo: 'chart1',
type: 'column',
height: 500,
width: 530
},
title: {
text: 'Success %'
},
xAxis: {
categories: ['Today', 'YesterDay', 'D-7'],
title: {
text: 'DAYs'
}
},
plotOptions: {
column: {
dataLabels: {
enabled: true
}
}
},
series: []
};
$(function ready() {
$.ajax({
url: 'successper.php',
type: 'GET',
async: true,
dataType: "json",
success: function(point1) {
options.series = point1;
alert(point1);
var chart = new Highcharts.Chart(options);
setTimeout(ready, 50000);
}
});
});
</script>
</head>
<body>
<div id="chart1" style="width: 300px; height: 200px; margin: center"></div>
</body>
</html>
是php文件的輸出,它會在每個5分鐘
[
{
name: 'DEL',
data: [96.65,96.71,96.37]
},
{
name : 'MUM',
data: [96.22,96.29,96.61]
},
{
name: 'KOL',
data: [97.21,97.56,97.24]
},
{
name: 'CHN',
data: [96.52,96.50,96.67]
}
]
嘗試使用[this](http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/members/series-setdata/)ie'chart.series [0] .setData(point1);' –