initial commit
[home-automation.git] / weather1-speed.php
1 <?php ob_start('ob_gzhandler') ?>
2 <?
3 function get_data($item) {
4   $doc = new DOMDocument();
5   $doc->load('http://weather/weather/all-output.xml');
6   $arrFeeds = array();
7   foreach ($doc->getElementsByTagName('weather') as $node) {
8     $itemRSS = array ( 
9       $item => $node->getElementsByTagName($item)->item(0)->nodeValue,
10       );
11     array_push($arrFeeds, $itemRSS);
12   }
13   echo $itemRSS[$item];
14 }
15 ?>
16 <!DOCTYPE html>
17 <html>
18 <head>
19     <script src="libraries/RGraph.common.core.js" ></script>
20     <script src="libraries/RGraph.common.context.js" ></script>
21     <script src="libraries/RGraph.common.annotate.js" ></script>
22     <script src="libraries/RGraph.common.tooltips.js" ></script>
23     <script src="libraries/RGraph.common.zoom.js" ></script>
24     <script src="libraries/RGraph.common.resizing.js" ></script>
25     <script src="libraries/RGraph.odo.js" ></script>
26     <!--[if IE 8]><script src="excanvas/excanvas.compressed.js"></script><![endif]-->
27
28     <script>
29         window.onload = function ()
30         {
31             var odo2 = new RGraph.Odometer('odo2', 0, 360, <? get_data("windDirectionDegrees"); ?>);
32             odo2.Set('chart.annotatable', false);
33             //odo2.Set('chart.needle.thickness', 6);
34             odo2.Set('chart.needle.color', 'black');
35             odo2.Set('chart.needle.tail', false);
36             //odo2.Set('chart.needle.type', 'triangle');
37             odo2.Set('chart.label.area', 22);
38             odo2.Set('chart.contextmenu', [['Clear', function () {RGraph.Clear(odo2.canvas); odo2.Draw();}]]);
39             //odo2.Set('chart.border', document.all ? false : true);
40             //odo2.Set('chart.tickmarks.highlighted', true);
41             odo2.Set('chart.labels', ['N','NE','E','SE','S','SW','W','NW']);
42             odo2.Set('chart.red.min', 360);
43             odo2.Set('chart.red.color', 'gray');
44             //odo2.Set('chart.value.text', true);
45             odo2.Set('chart.value.units.post', ' degrees');
46             odo2.Draw();
47
48         }
49     </script>
50 </head>
51 <body>
52
53         <canvas id="odo2" width="200" height="200"><div class="canvasfallback">[No canvas support]</div></canvas>
54 </body>
55 </html>