-
Notifications
You must be signed in to change notification settings - Fork 1
/
graph.html
69 lines (56 loc) · 2.29 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Query Executor</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="Run Me A Query">
<script src="raphael-min.js" type="text/javascript" charset="utf-8"></script>
<script src="g.raphael-min.js" type="text/javascript" charset="utf-8"></script>
<script src="g.line-min.js" type="text/javascript" charset="utf-8"></script>
<script src="jquery-1.6.4.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
window.onload = function() {
$.ajax({
url: document.location + "/data",
dataType: 'json',
success: function(content) {
if (content != "") {
updateSucceeded(content);
}
else {
//setTimeout(updateContent, 2000);
}
},
error: function(details) { console.log(details) },
beforeSend: function(){$(".icon").addClass("active")},
complete: function(){$(".icon").removeClass("active")}
});
}
function updateSucceeded(content) {
console.log(content)
var r = Raphael("holder");
$('#query').val(content.query)
$('#alias').val(content.alias)
r.g.txtattr.font = "12px 'Fontin Sans', Fontin-Sans, sans-serif";
var x = content.data.x
var xlabels = content.data.xlabels
var y = content.data.y
r.g.linechart(10, 10, 1400, 220, x, y, {axisxlabels: xlabels});
// label the graph with the query
r.g.text(160, 10, content.query)
};
</script>
</head>
<body class="raphael">
<div id="holder"></div>
<form action="/" method="post">
<label for="query">Query:</label>
<br/>
<textarea name="query" id="query"></textarea>
<br/>
<input type="hidden" name="parent" id="alias"/>
<input type="submit"/>
</form>
</body>
</html>