-
Notifications
You must be signed in to change notification settings - Fork 0
/
graph.html
46 lines (46 loc) · 1.48 KB
/
graph.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="javascript" type="text/javascript" src="http://www.thomas-maier.net/jquery.js"></script>
<script language="javascript" type="text/javascript" src="http://www.thomas-maier.net/jquery.flot.js"></script>
</head>
<body>
<center><img src="http://www.thomas-maier.net/laserlogo2.png"></center>
<center><div id="placeholder" style="width:1700px;height:750px;"></div></center>
<script type="text/javascript">
function getData() {
var responseData = $.ajax({
url:"data",
async: false,
type: "GET",
data: ""
}).responseText;
data = eval('(' + responseData + ')');
console.log(data);
chartdata = []
for(var key in data) {
elems = []
for(index in data[key]) {
elems[elems.length] = [index ,data[key][index][1]];
}
chartdata.push({data: elems, label: key});
}
return chartdata;
}
var plot;
function buildChart() {
plot = $.plot($("#placeholder"), getData(), {yaxis: {min:0, max:7}});
}
function updateChart() {
plot.setData(getData());
plot.setupGrid();
plot.draw();
}
$(function () {
buildChart();
});
setInterval(updateChart, 1000);
</script>
</body>
</html>