Changeset 7878 for code/Website/graph_bar.php
- Timestamp:
- Apr 30, 2010, 4:27:34 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/Website/graph_bar.php
r7849 r7878 5 5 6 6 7 $result = mysql_query("select AVG(value) AS average FROM tuples LEFT JOIN sensors ON tuples.sensorID=sensors.sensorID WHERE end IS NULL GROUP BY sensors.roomID"); 7 $result = mysql_query(" 8 select AVG(`tuples`.value) AS average, `rooms`.name AS xaxis 9 FROM (`save_energy`.`tuples`) 10 JOIN `save_energy`.`sensors` ON (`tuples`.sensorID=`sensors`.sensorID) 11 JOIN `save_energy`.`rooms` ON (`sensors`.roomID=`rooms`.roomID) 12 WHERE `sensors`.name LIKE '%power' 13 AND DATE(`tuples`.start) = CURRENT_DATE() - INTERVAL 1 DAY 14 GROUP BY `rooms`.name;"); 8 15 9 16 $data = array(); … … 11 18 { 12 19 $data[] = intval($row['average']); 20 $xaxis[] = ($row['xaxis']); 13 21 } 14 22 15 $title = new title( 'All rooms' );23 $title = new title( 'Alle kamers' ); 16 24 17 25 $bar = new bar(); 18 26 $bar->colour( '#BF3B69'); 19 $bar->key('Gemiddelde ', 14);27 $bar->key('Gemiddelde energieverbruik van gisteren in Watt', 14); 20 28 $bar->set_values( $data ); 21 29 $bar->set_on_click("bar_1"); … … 35 43 $x = new x_axis(); 36 44 $x->colour('#000000')->grid_colour('#D8D8D8'); 37 $x_legend = new x_legend( 'Kamer ID' );45 $x_legend = new x_legend( 'Kamer nummer' ); 38 46 $x_legend->set_style( '{font-size: 14px; color: #000000}' ); 47 48 $x_labels = new x_axis_labels(); 49 $x_labels->set_colour( '#000000' ); 50 $x_labels->set_labels( $xaxis ); 51 $x->set_labels( $x_labels ); 52 39 53 40 54 … … 50 64 //$chart->add_element( $bar2 ); 51 65 66 echo $chart->toPrettyString(); 67 $chartwrite = $chart->toPrettyString(); 52 68 53 echo $chart->toString(); 69 $fh = fopen("graphs/bar.txt", 'w') or die("can't open file"); 70 fwrite($fh, $chartwrite); 71 fclose($fh); 54 72 ?>
Note:
See TracChangeset
for help on using the changeset viewer.