我正在通過閱讀tmp文件夾中的json文件繪製一個圖。以下是tmp目錄結構。在點擊按鈕上更新圖表
TMP
data10
data20
data30
.........
........
........
data100
代碼:
Follwing代碼從TMP文件夾讀出的文件,並使用highchart生成曲線。
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title> - jsFiddle demo</title>
<script type='text/javascript' src='http://code.jquery.com/jquery-1.9.1.js'></script>
<link rel="stylesheet" type="text/css" href="/css/result-light.css">
<style type='text/css'>
</style>
<script type='text/javascript'>
$(function() {
var options = {
chart :{
type: 'polygon',
renderTo: 'container',
zoomType:'x'
},
title: {
text: ''
},
yAxis: {
title: false,
gridLineWidth:0,
lineWidth:0,
labels:{
enabled: false
}
},
xAxis: {
title: false,
gridLineWidth:0,
lineWidth:0,
labels:{
enabled: false
}
},
plotOptions: {
series: {
lineWidth: 1,
lineColor:'black'
}
},
series: []
};
$.getJSON('data20.json', function(data) {
options.series=data;
var chart = new Highcharts.Chart(options);
})
$.getJSON('tmp/title.json', function(title) {
options.title.text=title;
var chart = new Highcharts.Chart(options);
})
});
function forward() {
//$('#plots-tabs-heatmap').load(); // update with dataset data10.json
}
function backward()
{
$('#plots-tabs-heatmap').load(); // update with dataset data30.json
}
</script>
</head>
<body>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/highcharts-more.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div>
<br>
<br>
<table>
<tr><td>
<img name="jsbutton" src="snipa/zoom-in.svg" width="110" height="28" border="0" alt="javascript button" onclick="forward();">
</td>
<td>
<img name="jsbutton" src="snipa/zoom-out.svg" width="110" height="28" border="0" alt="javascript button" onclick="backward();">
</td>
</tr>
</table>
</body>
當我點擊按鈕如何更新圖表與下一個數據集文件夾?
粘貼你的確切json在這裏。 –