blob: c32445c6c8fbed0359b70c9a27166d08a64613e8 (
plain)
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
69
70
71
72
|
<html>
<head>
<script src="lib/jquery-1.6.2/jquery-1.6.2.min.js"></script>
<script src="lib/d3-v2.6.1/d3.js"></script>
<style>
#log {
height: 300px;
overflow-y: scroll;
}
</style>
</head>
<body>
<div id="image">
</div>
<div id="log">
</div>
<script>
var mapping = {
"heizkesselWert" : "heizkreisregler10.betriebsdatenRegler1.kesselTemperatur",
"tempkollektorWert" : "heizkreisregler9.solarDaten.tempKollektor",
"boilerWert" : "feuerungsautomat1.betriebsdatenRegler1.boilerTemperatur"
};
function timeToString(timestamp) {
var d = new Date();
return "" + d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds();
}
function log(data) {
for (var i in data) {
var row = data[i];
var sensor_name = data[i][0];
var timestamp = data[i][1];
var value = data[i][2];
var caption = "" + timeToString(row.timestamp) + ": " + row.name + " Value: " + row.value_real + " - " + row.value_string;
jQuery("div#log").prepend(
jQuery("<div>").text(caption));
for (var mapping_element_id in mapping) {
var mapping_sensor_name = mapping[mapping_element_id];
if (row.name == mapping_sensor_name) {
d3.select("#" + mapping_element_id).text("" + row.value_real);
}
}
}
}
function reload(time_stop) {
jQuery.getJSON("../stream/" + time_stop, function(resp) {
log(resp.data);
reload(resp.time_stop);
});
}
jQuery(document).ready(function() {
d3.xml("draw.svg", "image/svg+xml", function(xml) {
jQuery("#image")[0].appendChild(xml.documentElement);
});
jQuery.getJSON("../all_values", function(resp) {
log(resp.data);
jQuery.getJSON("../stream", function(resp) {
log(resp.data);
reload(resp.time_stop);
});
});
});
</script>
</body>
</html>
|