diff options
author | Yves Fischer <yvesf-git@xapek.org> | 2011-12-06 19:31:51 +0100 |
---|---|---|
committer | Yves Fischer <yvesf-git@xapek.org> | 2011-12-06 19:31:51 +0100 |
commit | 4f67e6e30f3300c948afbc498ac7fb71ea8e431f (patch) | |
tree | fc1534c15ca1ee6b1b56efff693ec2110b2b24a9 /ebus/webapp/static/console.html | |
parent | a6f7d26fd72222970226018d423c7138f34c7c0e (diff) | |
download | ebus-alt-4f67e6e30f3300c948afbc498ac7fb71ea8e431f.tar.gz ebus-alt-4f67e6e30f3300c948afbc498ac7fb71ea8e431f.zip |
svg demo
Diffstat (limited to 'ebus/webapp/static/console.html')
-rw-r--r-- | ebus/webapp/static/console.html | 48 |
1 files changed, 43 insertions, 5 deletions
diff --git a/ebus/webapp/static/console.html b/ebus/webapp/static/console.html index 83dce58..c32445c 100644 --- a/ebus/webapp/static/console.html +++ b/ebus/webapp/static/console.html @@ -1,20 +1,47 @@ <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 = "" + timestamp + ": " + sensor_name + " Value: " + value; + var caption = "" + timeToString(row.timestamp) + ": " + row.name + " Value: " + row.value_real + " - " + row.value_string; - jQuery("div#log").append( + 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); + } + } } } @@ -25,9 +52,20 @@ }); } - jQuery.getJSON("../stream", 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> |