sensorgauges
authorBernhard Tittelbach <xro@realraum.at>
Thu, 17 Oct 2013 16:06:21 +0000 (16:06 +0000)
committerBernhard Tittelbach <xro@realraum.at>
Thu, 17 Oct 2013 16:06:21 +0000 (16:06 +0000)
raspberry-kiosk/kiosk.js
raspberry-kiosk/kiosk768x1366.html

index 457a359..d506e1e 100644 (file)
@@ -170,43 +170,38 @@ function drawGauge(targetelem, label, temp, options) {
     if (targetelem)
     {
         var data = google.visualization.arrayToDataTable([["Label", "Value"],[label,temp]]);
-        options["width"] = targetelem.getAttribute("width");
-        options["height"] = targetelem.getAttribute("height");
-       if (!gauges.hasOwnProperty(targetelem.id)) {
-               gauges[targetelem.id] = new google.visualization.Gauge(targetelem);
-       }
+        if (!gauges.hasOwnProperty(targetelem.id)) {
+            gauges[targetelem.id] = new google.visualization.Gauge(targetelem);
+        }
         gauges[targetelem.id].draw(data, options);
     }
 }
 
 var linecharts = {}
 function drawLineGraph(targetelem, dataarray, options, x_is_epochdate) {
-  if (dataarray) {
-      var data;
-      if (x_is_epochdate) {
-        data=new google.visualization.DataTable();
-       data.addColumn('datetime',dataarray[0][0]);
-        for (var c=1; c<dataarray[0].length; c++) {
-         data.addColumn('number',dataarray[0][c]);
-        }
-       for (var r=1; r<dataarray.length; r++) {
-         dataarray[r][0] = new Date(dataarray[r][0]*1000);
-         data.addRow(dataarray[r]);
-        }
-      } else {
-        data = google.visualization.arrayToDataTable(dataarray);
+  if (dataarray && targetelem) {
+    var data;
+    if (x_is_epochdate) {
+      data=new google.visualization.DataTable();
+      data.addColumn('datetime',dataarray[0][0]);
+      for (var c=1; c<dataarray[0].length; c++) {
+        data.addColumn('number',dataarray[0][c]);
       }
-      // Create and draw the visualization.
-      if (targetelem)
-      {
-          options["width"]= targetelem.getAttribute("width");
-          options["height"]=targetelem.getAttribute("height");
-         if (!linecharts.hasOwnProperty(targetelem.id)) {
-              linecharts[targetelem.id] = new google.visualization.LineChart(targetelem);
-         }
-          linecharts[targetelem.id].draw(data, options);
-        }
+      for (var r=1; r<dataarray.length; r++) {
+        dataarray[r][0] = new Date(dataarray[r][0]*1000);
+        data.addRow(dataarray[r]);
+      }
+    } else {
+      data = google.visualization.arrayToDataTable(dataarray);
+    }
+    // Create and draw the visualization.
+    options["width"]= targetelem.getAttribute("width");
+    options["height"]=targetelem.getAttribute("height");
+    if (!linecharts.hasOwnProperty(targetelem.id)) {
+      linecharts[targetelem.id] = new google.visualization.LineChart(targetelem);
     }
+    linecharts[targetelem.id].draw(data, options);
+  }
 }
 
 function loadAndDrawSensorData() {
index b11d22e..b88c5db 100644 (file)
   </div>
  <table border="0" cellpadding="0" cellspacing="0"><tr>
  <td style="vertical-align:top; padding-right:3px;">
- <div class="sensorgauges">
+ <div class="sensorgauges" style="margin-bottom:0px; padding-bottom:0px;">
  <p class="topic">Sensorwerte</p>
  <div id="anwesenheit_status_kiosk" style="height:100px; border:0px none black;">Lädt ...</div>
  <div id="sensor_status" style="border:0px none black; margin-top:5px;">Lädt ...</div>
- <div id="tempgauge" style="width: 260px; height: 260px;"></div>
- <div id="lightgauge" style="width: 260px; height: 260px;"></div>
+ <div id="tempgauge" style="width: 260px; height: 260px; padding-left:5px; margin-bottom:-10px;"></div>
+ <div id="lightgauge" style="width: 260px; height: 260px; padding-left:5px; margin-bottom:-8px;"></div>
  </div>
+   <table border="0" style="width:268px; margin:0px; padding:0px;" cellpadding="0" cellspacing="0">
+   <tr>
+   <td><img src="./qr_realraum.at.png" width="130" height="130" style="margin-top:7px; margin-left:0px; margin-right:5px;"/></td>
+   <td style="text-align:right;"><img src="./qr_r3_g+.png"  width="130" height="130" style="margin-top:7px; margin-left:0px; margin-right:0px;"/></td>
+   <td></td>
+   </tr>
+   </table>
  </td>
   </td><td style="vertical-align:top;">
    <!-- Google Plus Wall ------------------------ -->