nicer output if no values are present at a sensor
parent
6cde55068f
commit
8109e077cd
|
|
@ -1,3 +1,8 @@
|
||||||
#WeatherstationServer
|
#WeatherstationServer
|
||||||
##Overview
|
##Overview
|
||||||
PHP, CSS, psChart, pChart, DBLib
|
PHP, CSS, psChart, pChart, DBLib
|
||||||
|
|
||||||
|
# TODO
|
||||||
|
|
||||||
|
* http://www.clemensklug.de/temp/new/?mode=month&year=2014&month=5
|
||||||
|
* wrong min_temp | 04.05.14
|
||||||
|
|
|
||||||
30
function.php
30
function.php
|
|
@ -57,6 +57,7 @@ function logStats($datas,$type,$alt=false,$outlineAlt=0,$mode=1){
|
||||||
$left=80;
|
$left=80;
|
||||||
$max=getMax($type);
|
$max=getMax($type);
|
||||||
for($num=0;$num<=$max;$num++){
|
for($num=0;$num<=$max;$num++){
|
||||||
|
$printValues=true;
|
||||||
if($num>0){
|
if($num>0){
|
||||||
$left+=300;
|
$left+=300;
|
||||||
}
|
}
|
||||||
|
|
@ -64,23 +65,32 @@ function logStats($datas,$type,$alt=false,$outlineAlt=0,$mode=1){
|
||||||
$unit=getUnit($type);
|
$unit=getUnit($type);
|
||||||
$stat=$timePoints=array();
|
$stat=$timePoints=array();
|
||||||
if($alt===false){
|
if($alt===false){
|
||||||
$stat=dataStat($datas[$num],$type);
|
if(is_array($data[$num])){
|
||||||
$timePoints=outLinedLogPoints($datas[$num]);
|
$stat=dataStat($datas[$num],$type);
|
||||||
|
$timePoints=outLinedLogPoints($datas[$num]);
|
||||||
|
}else{
|
||||||
|
$printValues=false;
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
$stat=$alt[$num];
|
$stat=$alt[$num];
|
||||||
$timePoints=$outlineAlt[$num];
|
$timePoints=$outlineAlt[$num];
|
||||||
|
$printValues = $stat['min'][1]!=0;
|
||||||
}
|
}
|
||||||
$output.="<div style='position:absolute;left:".$left."px;'>\n";
|
$output.="<div style='position:absolute;left:".$left."px;'>\n";
|
||||||
$output.=$type.($num+1)."<br>\n";
|
$output.=$type.($num+1)."<br>\n";
|
||||||
$output.="minimum: ".$stat['min'][0]." @ ".ttdls((int) $stat['min'][1],$mode)."<br>\n";
|
if($printValues){
|
||||||
$output.="maximum: ".$stat['max'][0]." @ ".ttdls((int) $stat['max'][1],$mode)."<br>\n";
|
$output.="minimum: ".$stat['min'][0]." @ ".ttdls((int) $stat['min'][1],$mode)."<br>\n";
|
||||||
$output.="average: ".$stat['avg']." @ ".ttdls2($stat['min'][1],$mode)."<br>\n";
|
$output.="maximum: ".$stat['max'][0]." @ ".ttdls((int) $stat['max'][1],$mode)."<br>\n";
|
||||||
$output.="Logpoints: ".$stat['size']." ".ttdls3((int) $stat['min'][1],$mode);
|
$output.="average: ".$stat['avg']." @ ".ttdls2($stat['min'][1],$mode)."<br>\n";
|
||||||
$output.="<br><br><br>";
|
$output.="Logpoints: ".$stat['size']." ".ttdls3((int) $stat['min'][1],$mode);
|
||||||
if($mode==1){
|
$output.="<br><br><br>";
|
||||||
foreach($timePoints as $point){
|
if($mode==1){
|
||||||
$output.=date("H:i:s",(int) $point[1])." - ".$point[0]/$div.$unit."<br>\n";
|
foreach($timePoints as $point){
|
||||||
|
$output.=date("H:i:s",(int) $point[1])." - ".$point[0]/$div.$unit."<br>\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
$output.="Keine Daten</div>";
|
||||||
}
|
}
|
||||||
$output.="</div>\n";
|
$output.="</div>\n";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ if(isset($_GET['mode']) && $_GET['mode']=='last'){
|
||||||
//mode: day
|
//mode: day
|
||||||
$mode=1;
|
$mode=1;
|
||||||
}else{
|
}else{
|
||||||
$html.="No/invalid type, default to temperature/today";
|
$html.="Keine weiteren Angaben: Heutige Temperatur wird angezeigt";
|
||||||
$mode=1;
|
$mode=1;
|
||||||
$type="temp";
|
$type="temp";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue