Author: zecas
Date: Fri Apr 11 17:11:02 2014
New Revision: 106

URL: http://svn.gna.org/viewcvs/zzzt?rev=106&view=rev
Log:
ajout d un graphique pour l annee

Added:
    trunk/stats/yearly.php

Added: trunk/stats/yearly.php
URL: http://svn.gna.org/viewcvs/zzzt/trunk/stats/yearly.php?rev=106&view=auto
==============================================================================
--- trunk/stats/yearly.php      (added)
+++ trunk/stats/yearly.php      Fri Apr 11 17:11:02 2014
@@ -0,0 +1,58 @@
+<?php
+  require '../inverter/class_inverter.php';
+  session_start();// after the needed classes
+  $inverter=new inverter();
+  $db=new db($inverter);
+  if(!isset($_GET['year'])) $_GET['year']=date('Y');
+  $year=$mois=$annees=$values=array();
+?>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+  <link rel="shortcut icon" href="../images/inverter.png" type="image/x-png"/>
+  <link rel="icon" href="../images/inverter.png" type="image/x-png"/>
+  <title><?php echo APPLICATION.' '.VERSION;?></title>
+  <link rel="stylesheet" href="../morris/morris-0.4.3.min.css">
+  <script src="../morris/jquery.min.js"></script>
+  <script src="../morris/raphael-min.js"></script>
+  <script src="../morris/morris-0.4.3.min.js"></script>
+
+  <style>
+    html, body { height: 95%; }
+    #holder { width: 98%; height: 100%; }
+  </style>
+</head>
+
+<body>
+  <b><a href=../inverter/index.php><?php echo APPLICATION;?></a></b>
+  <a href=daily.php><?php echo BY_DAY;?></a>
+  <a href=monthly.php><?php echo BY_MONTH;?></a>
+  <?php echo KYR;?>
+  <a href=index.php><?php echo DAY_PROD;?></a>
+
+  <?php
+  $sql="SELECT DATE_FORMAT(date,'%Y') AS year,production FROM zzzt_yearly 
UNION SELECT DATE_FORMAT(date,'%Y') AS year,production FROM zzzt_yearcurrent 
ORDER BY year ASC";
+  $db->query($sql);
+  while ($row = $db->fetch()) $values[]=$row;
+?>
+
+  <script type="text/javascript" charset="utf-8">
+    document.write("<div id=\"holder\"></div>");
+     
+    new Morris.Area({element: 'holder', lineColors: ['#<?php echo 
$db->rnd_color(); ?>'], 
+      continuousLine: false, fillOpacity: 0.5, postUnits: 'kWh', 
behaveLikeLine: true, parseTime: false, hideHover: 'auto',  data: [
+      <?php
+         for($i=0; $i<sizeof($values); $i++) {
+         echo "{ a: '{$values[$i]['year']}', 'y': {$values[$i]['production']} 
";
+         if($i<sizeof($values)-1) echo " },\n"; else echo " }\n";
+       }
+      ?>
+      ], xkey: 'a', ykeys: ['y'], labels: [''] });
+
+  </script>
+  <noscript><img src=image_by_month.php?width=1000&amp;height=600></noscript>
+
+
+</body>
+</html>


_______________________________________________
Zzzt-commits mailing list
Zzzt-commits@gna.org
https://mail.gna.org/listinfo/zzzt-commits

Reply via email to