Fixed restoration of the panel divider position.
[psensor.git] / www / details.html
index 43c38cc..68656a0 100644 (file)
@@ -1,88 +1,60 @@
 <html>
   <head>
     <meta charset="utf-8">
-    <title>Sensor </title>
+    <title id="title">Sensor </title>
 
-    <link type="text/css" rel="stylesheet" href="http://fonts.googleapis.com/css?family=Ubuntu:regular,bold&subset=Latin">
+    <link href="jqplot.css" rel="stylesheet" type="text/css"/> 
+    <link href="style.css" rel="stylesheet" type="text/css"/>  
 
-    <link type="text/css" href="style.css" rel="stylesheet" /> 
+    <script src="jquery.js" type="text/javascript"></script>
+    <script src="jqplot.js" type="text/javascript"></script>
+    <script src="jqplot.dateAxisRenderer.js" type="text/javascript"></script>
 
-    <script type="text/javascript" src="jquery.js"></script>
-    <script type="text/javascript" src="jqplot.js"></script>
-    <link   type="text/css"        href="jqplot.css" rel="stylesheet" />       
-    <script type="text/javascript" src="jqplot.dateAxisRenderer.js"></script>
-
-    <script type="text/javascript" src="psensor.js"></script>
+    <script src="psensor.js" type="text/javascript"></script>
 
     <script>
       $(document).ready(function() {
-         var max_date = null;
-         var min_date = null;
-          var min, max, value;
-          var params = get_url_params();
-          var url_id = params["id"];
-
-          min = max = null;
+               var url_id;
 
-          $.getJSON(url_id, function(data) {
-              var measures = data["measures"];
-              var data_chart = [];
+               url_id = get_url_params()["id"];
 
-              $("#title").append(data["name"]);
-              $("title").append(data["name"]);
+               update_menu();
+               $.getJSON(url_id, function(data) {
+                               update_chart("chart", type_to_str(data["type"]), data);
+               });
 
-              $.each(measures, function(i, item) {
-                  value = item["value"];
-                  var d = new Date(item["time"]*1000);
-                  var entry = [d, item["value"]];
+               setInterval(function() {
+                       $.getJSON(url_id, function(data) {
+                               update_chart("chart", type_to_str(data["type"]), data);
+                       });
+               }, 5000);
 
-                  data_chart.push(entry);
-      
-                 if (max_date == null || max_date < d)
-                    max_date = d;
-                  
-                 if (min_date == null || min_date > d)
-                   min_date = d;
-            
-                  if (min == null || value < min)
-                    min = value;
-                 if (max == null || value > max)
-                    max = value;
+               // reload page in order to workaround memory-leak in JQPlot
+               setInterval(function() {
+                       location.reload();
+               }, 60000);
 
-              });
-
-              var plot1 = $.jqplot ('chart1', [data_chart], 
-                  {
-                      title: type_to_str(data["type"]),
-                      axes:{
-                          xaxis:{
-                              renderer:$.jqplot.DateAxisRenderer,
-                              tickOptions:{formatString:'%H:%M:%S'},
-                             min: min_date,
-                             max: max_date
-                          },
-                         yaxis: {
-                             min: min-1,
-                              max: max+1
-                         }
-                      },
-                      series: [{lineWidth:1,showMarker:false}]
-                  });
-          });
       });
     </script>
   </head>
   <body>
-    <div class='page'>
-      <div class='page-header'>
-        <h1 id='title'></h1>
-      </div>
 
-      <div class="chart">
-       <div id='chart1'></div>
+    <div id="page">
+      <div id="menu">
+       <ul id="menu-list">
+         <li><a href="index.html">Summary</a></li>
+       </ul>
+      </div>
+      
+      <div id="main">
+       <h1></h1>
+       
+       <div class="chart" id="chart"></div>    
+      </div>
+      
+      <div id="footer">
+       Generated by <a href='http://wpitchoune.net/psensor'>psensor-server</a>
       </div>
     </div>
-
-    <div id="footer">Generated by <a href='http://wpitchoune.net/psensor'>psensor-server</a></div>
   </body>
 </html>