title of the graph is the string representation of the type of sensor
[psensor.git] / www / details.html
1 <html>
2   <head>
3     <meta charset="utf-8">
4     <title>Sensor details</title>
5
6     <link type="text/css" href="style.css" rel="stylesheet" />  
7     <script type="text/javascript" src="jquery.js"></script>
8     <script type="text/javascript" src="psensor.js"></script>
9     <script type="text/javascript" src="jquery.jqplot.min.js"></script>
10     <script type="text/javascript" src="jqplot.dateAxisRenderer.min.js"></script>
11
12     <script>
13       $(document).ready(function() {
14           var params = get_url_params();
15           var url_id = params["id"];
16
17
18           $.getJSON("/api/1.0/sensors/"+url_id, function(data) {
19               var measures = data["measures"];
20               var data_chart = [];
21
22               $("#title").append(data["name"]);
23
24               $.each(measures, function(i, item) {
25                   var d = new Date(item["time"]*1000);
26                   var entry = [d, item["value"]];
27                   data_chart.push(entry);
28               });
29
30               var plot1 = $.jqplot ('chart1', [data_chart], 
31                   {
32                       title: type_to_str(data["type"]),
33                       axes:{
34                           xaxis:{
35                               renderer:$.jqplot.DateAxisRenderer,
36                               tickOptions:{formatString:'%H:%M:%S'}
37                           }
38                       },
39                       series: [{lineWidth:1,showMarker:false}]
40                   });
41           });
42       });
43     </script>
44   </head>
45   <body>
46     <div class='page'>
47       <div class='page-header'>
48          <h1 id='title'>Details </h1>
49       </div>
50
51       <div class='page-content'>
52         <div id='chart1'></div>
53       </div>
54     </div>
55
56     <div class='page-footer'>
57       <a href='http://wpitchoune.net/psensor'>Psensor Server</a> - (c)2011 jeanfi@gmail.com 
58     </div>    
59
60   </body>
61 </html>