size(4)->halo_size(2)->colour('#000000'); foreach($description as $value) { $colorcode++; if($colorcode==1) {$color = '#f7921c';} if($colorcode==2) {$color = '#bf7115';} if($colorcode==3) {$color = '#6c3d06';} if($colorcode==4) {$color = '#2d1d0a';} $name=$value; $result1 = mysql_query(" SELECT value AS value FROM (`save_energy`.`tuples`) JOIN `save_energy`.`sensors` ON (`tuples`.sensorID=`sensors`.sensorID) JOIN `save_energy`.`rooms` ON (`sensors`.roomID=`rooms`.roomID) WHERE DATE(`tuples`.start) = CURRENT_DATE() - INTERVAL 47 DAY AND `rooms`.name='$room' AND `sensors`.description='$name' ORDER BY `tuples`.start ASC "); while($row = mysql_fetch_array($result1)) { $data[] = intval($row['value']); } $value = new line(); $value->set_default_dot_style($line_default_dot); $value->set_values( $data ); $value->set_width( 2 ); $value->set_colour($color); $value->set_key($name, 14); $chart->add_element( $value ); unset($data); } $y = new y_axis(); $y->set_range( 0, 60, 6 ); $y->set_colour('#000000'); $y->set_grid_colour('#D8D8D8'); $x = new x_axis(); $x->offset(false)->steps(10); $x->colour('#000000')->grid_colour('#D8D8D8'); $x_labels = new x_axis_labels(); $x_labels->set_steps( 50 ); $x_labels->set_colour( '#000000' ); $x_labels->set_labels( $xaxis ); $x->set_labels( $x_labels ); $title = new title('Temperatuur in kamer '.$room.' in Celsius'); $chart->set_title( $title ); $chart->set_x_axis( $x ); $chart->set_y_axis( $y ); $chart->set_bg_colour( '#FFFFFF' ); echo $chart->toPrettyString(); $chartwrite = $chart->toPrettyString(); $fh = fopen("graphs/temp_".$room.".txt", 'w') or die("can't open file"); fwrite($fh, $chartwrite); fclose($fh); unset($xaxis); } ?>