Ignore:
Timestamp:
Apr 30, 2010, 4:27:34 PM (15 years ago)
Author:
dennisw
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/Website/graph_bar.php

    r7849 r7878  
    55
    66
    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;");
    815
    916$data = array();
     
    1118{
    1219  $data[] = intval($row['average']);
     20  $xaxis[] = ($row['xaxis']);
    1321}
    1422
    15 $title = new title( 'All rooms' );
     23$title = new title( 'Alle kamers' );
    1624
    1725$bar = new bar();
    1826$bar->colour( '#BF3B69');
    19 $bar->key('Gemiddelde', 14);
     27$bar->key('Gemiddelde energieverbruik van gisteren in Watt', 14);
    2028$bar->set_values( $data );
    2129$bar->set_on_click("bar_1");
     
    3543$x = new x_axis();
    3644$x->colour('#000000')->grid_colour('#D8D8D8');
    37 $x_legend = new x_legend( 'Kamer ID' );
     45$x_legend = new x_legend( 'Kamer nummer' );
    3846$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
    3953
    4054
     
    5064//$chart->add_element( $bar2 );
    5165
     66echo $chart->toPrettyString();
     67$chartwrite = $chart->toPrettyString();
    5268
    53 echo $chart->toString();
     69$fh = fopen("graphs/bar.txt", 'w') or die("can't open file");
     70fwrite($fh, $chartwrite);
     71fclose($fh);
    5472?>
Note: See TracChangeset for help on using the changeset viewer.