summaryrefslogtreecommitdiff
path: root/ebus/webapp/static/console.html
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2011-12-11 01:14:24 +0100
committerYves Fischer <yvesf-git@xapek.org>2011-12-11 01:14:24 +0100
commitf1c5d0c337cbb8cd072594f85ebd3419653a34ae (patch)
treef144b2b31e9a4e52132a1934d13654b6508f7118 /ebus/webapp/static/console.html
parent16455a269c8d8d22a0015458f4ccae2530e7d469 (diff)
downloadebus-alt-f1c5d0c337cbb8cd072594f85ebd3419653a34ae.tar.gz
ebus-alt-f1c5d0c337cbb8cd072594f85ebd3419653a34ae.zip
refactor svg ui
Diffstat (limited to 'ebus/webapp/static/console.html')
-rw-r--r--ebus/webapp/static/console.html107
1 files changed, 0 insertions, 107 deletions
diff --git a/ebus/webapp/static/console.html b/ebus/webapp/static/console.html
deleted file mode 100644
index e905c28..0000000
--- a/ebus/webapp/static/console.html
+++ /dev/null
@@ -1,107 +0,0 @@
-<html>
-<head>
- <title>Console</title>
- <script src="lib/d3-v2.6.1/d3.js" type="text/javascript"></script>
- <script src="lib/d3-v2.6.1/d3.time.js" type="text/javascript"></script>
- <script src="src/d3.plot.js" type="text/javascript"></script>
- <style>
- path {
- stroke: steelblue;
- stroke-width: 2;
- fill: none;
- }
- line {
- stroke: black;
- }
- div.popup {
- position: absolute;
- border: 2px solid gray;
- background-color: #fefefe;
- }
- div.popup .plot {
- margin: 5px;
- }
- #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 process(data) {
- for (var i in data) {
- var row = data[i];
- var caption = "[" + d3.format("02d")(row.timestamp) + "] " + row.name + " Value: " + row.value_real + " - " + row.value_string;
-
- d3.select("#log").insert("div", "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(document.getElementById(mapping_element_id))
- .text(""+row.value_real);
- }
- }
- }
- }
-
- function reload(time_stop) {
- d3.json("../stream/" + time_stop, function(resp) {
- if (resp == null) return;
- process(resp.data);
- reload(resp.time_stop);
- });
- }
-
- d3.xml("draw.svg", "image/svg+xml", function(xml) {
- // Write SVG Data into the DOM
- d3.select("#image")[0][0].appendChild(xml.documentElement);
-
- // Create Popup
- for (var mapping_element_id in mapping) {
- d3.select(document.getElementById(mapping_element_id))
- .on("click", function() {
- var elem = d3.select( this );
- var sensor_name = mapping[elem.attr("id")];
- var popup = d3.select("body")
- .append("div")
- .classed("popup", true)
- .style("top", d3.event.clientY-5)
- .style("left", d3.event.clientX-5)
- .on("click", function() {
- d3.select(this).remove();
- });
- popup.append("div")
- .text(sensor_name);
-
- var startdate = (new Date().getTime()/1000) - 7*60*60*24
- var enddate = (new Date().getTime()/1000)
- var plot = d3.plot(popup);
- d3.json("../sensor/"+sensor_name+"/" + startdate + "/" + enddate, function(resp) {
- var data = resp.data.map(function(d) {
- return [new Date(d[0]), d[1]];
- })
- plot.draw(data);
- });
- });
- }
-
- d3.json("../all_values", function(resp) {
- process(resp.data);
- reload(resp.time_stop);
- });
- });
-</script>
-</body>
-</html>