timestamp); fputs($f1,"$date $gnudraw $row->value\n"); } fclose($f1); } $gplotmain=" set ylabel 'Temperature (Celsius)' set y2label 'Humidity (%)' plot '$logfile' using 1:4 axes x1y1 title 'Temperature' with lines lw 2,\ '$logfile' using 1:6 axes x1y2 title 'Rel. Humidity (%)' with lines "; break; Case WS300_t2: ############################################ if ($DBUse==1) { $sqlarray=mysql_query("select timestamp,reading,value from history where device='".$gnudraw."' and reading='data' order by timestamp desc limit ".$logrotateKS300lines."") or die (mysql_error()); while ($row = mysql_fetch_object($sqlarray)) { $date=str_replace(" ","_",$row->timestamp); fputs($f1,"$date $gnudraw $row->value\n"); } fclose($f1); } $gplotmain=<<timestamp); fputs($f1,"$date $gnudraw $row->value\n"); } fclose($f1); } $gplotmain=" set ylabel 'Temperature (Celsius)' set y2label 'Humidity (%)' plot '$logfile' using 1:4 axes x1y1 title 'Temperature' with lines lw 2,\ '$logfile' using 1:6 axes x1y2 title 'Rel. Humidity (%)' with lines "; break; Case KS300_t2: ############################################ if ($DBUse==1) { $sqlarray=mysql_query("select timestamp,reading,value from history where device='".$gnudraw."' and reading='data' order by timestamp desc limit ".$logrotateKS300lines."") or die (mysql_error()); while ($row = mysql_fetch_object($sqlarray)) { $date=str_replace(" ","_",$row->timestamp); fputs($f1,"$date $gnudraw $row->value\n"); } fclose($f1); } $gplotmain=" set ylabel 'Wind (Km/h)' set y2label 'Rain (l/m2)' plot '$logfile' using 1:8 axes x1y1 title 'Wind' with lines, \ '$logfile' using 1:10 axes x1y2 title 'Rain' with lines "; break; Case FHT: ############################################ if ($DBUse==1) { $sqlarray=mysql_query("select timestamp,reading,value from history where device='".$gnudraw."' order by timestamp desc limit ".$logrotateFHTlines."") or die (mysql_error()); while ($row = mysql_fetch_object($sqlarray)) { $date=str_replace(" ","_",$row->timestamp); fputs($f1,"$date $gnudraw $row->reading $row->value\n"); } fclose($f1); } $gplotmain=" set ylabel 'Temperature (Celsius)' set yrange [$FHTyrange] set grid ytics set y2label 'Actuator (%)' set y2range [$FHTy2range] "; $gplotmain2=" set ylabel 'Temperature (Celsius)' set grid ytics "; $gplotmaintmp = <<timestamp); fputs($f1,"$date $gnudraw $row->value\n"); } fclose($f1); } $gplotmain=" set ylabel 'Temperature (Celsius)' plot '$logfile' using 1:4 axes x1y1 title 'Temperature' with lines lw 2 "; break; Case userdef: ############################################ $gplotmain=<<timestamp); fputs($f1,"$date $gnudraw $row->value\n"); } fclose($f1); } $gplotmain=" set ylabel 'Temperature (Celsius)' set y2label 'Humidity (%)' plot '$logfile' using 1:4 axes x1y1 title 'Temperature' with lines lw 2,\ '$logfile' using 1:6 axes x1y2 title 'Rel. Humidity (%)' with lines "; break; default: endswitch; $message=$OUT1.$gplothdr.$xrangeweek.$gplotmain; $f3=fopen("tmp/gnu1","w+"); fputs($f3,$message); fclose($f3); exec("$gnuplot tmp/gnu1",$output); $message=$OUT2.$gplothdr.$xrange.$gplotmain; $f2=fopen("tmp/gnu2","w"); fputs($f2,$message); fclose($f2); exec("$gnuplot tmp/gnu2",$output); $FOUT='tmp/'.$gnudraw1.'.'.$pictype; $FS=filesize($FOUT); if (($FS == '0') and ($gnutyp != "userdef")) ##Grafic mistake (e.G. no actuator). Draw againg without actuator { $message=$OUT1.$gplothdr.$gplotmain2; $f1=fopen("tmp/gnu1","w"); fputs($f1,$message); fclose($f1); exec("$gnuplot tmp/gnu1",$output); $message=$OUT2.$gplothdr.$xrange.$gplotmain2; $f2=fopen("tmp/gnu2","w"); fputs($f2,$message); fclose($f2); exec("$gnuplot tmp/gnu2",$output); } }; ?>