added todo

highcharts
agp8x 2015-05-07 18:28:57 +02:00
parent 82418d8d1a
commit 4bffffc256
2 changed files with 9 additions and 11 deletions

View File

@ -30,7 +30,7 @@ function importLogfileToDatabase($fileImport){
foreach($file as $line){ foreach($file as $line){
$line=explode(";",$line); $line=explode(";",$line);
if($emptyDB){ if($emptyDB){
$db->insert($logtype[0],array('time'=>$line[1],'value'=>$line[0])); $db->insert($logtype[0],array('time'=>$line[1],'value'=>$line[0]));
}else{ }else{
@ -39,7 +39,7 @@ function importLogfileToDatabase($fileImport){
} }
} }
} }
} }
function validFile($filename){ function validFile($filename){
$humi=(strpos($filename,'humi')===false); $humi=(strpos($filename,'humi')===false);
@ -214,7 +214,7 @@ function getDay(){
global $year; global $year;
return array($month,$day,$year); return array($month,$day,$year);
} }
function getNearest($data,$time,$last=-1){ function getNearest($data,$time,$last=-1){
if(!is_array($data)){ if(!is_array($data)){
return array(0,$time); return array(0,$time);
} }
@ -285,9 +285,9 @@ function drawChart($myData,$target,$date,$type){
$width=1200; $width=1200;
$height=600; $height=600;
$fontsize=12; $fontsize=12;
$myData->setSerieDescription("Labels","Stunde"); $myData->setSerieDescription("Labels","Stunde");
$myData->setAbscissa("Labels"); $myData->setAbscissa("Labels");
$myPicture = new pImage($width,$height,$myData); $myPicture = new pImage($width,$height,$myData);
#$myPicture->Antialias = FALSE;#antialiasing off #$myPicture->Antialias = FALSE;#antialiasing off
$Settings = array("R"=>170, "G"=>183, "B"=>87, "Dash"=>1, "DashR"=>190, "DashG"=>203, "DashB"=>107); $Settings = array("R"=>170, "G"=>183, "B"=>87, "Dash"=>1, "DashR"=>190, "DashG"=>203, "DashB"=>107);
@ -297,7 +297,7 @@ function drawChart($myData,$target,$date,$type){
$myPicture->drawGradientArea(0,0,$width,$height,DIRECTION_VERTICAL,$Settings); $myPicture->drawGradientArea(0,0,$width,$height,DIRECTION_VERTICAL,$Settings);
$myPicture->drawGradientArea(0,0,$width,20,DIRECTION_VERTICAL,array("StartR"=>0,"StartG"=>0,"StartB"=>0,"EndR"=>50,"EndG"=>50,"EndB"=>50,"Alpha"=>80)); $myPicture->drawGradientArea(0,0,$width,20,DIRECTION_VERTICAL,array("StartR"=>0,"StartG"=>0,"StartB"=>0,"EndR"=>50,"EndG"=>50,"EndB"=>50,"Alpha"=>80));
$myPicture->drawRectangle(0,0,$width-1,$height-1,array("R"=>0,"G"=>0,"B"=>0));#border $myPicture->drawRectangle(0,0,$width-1,$height-1,array("R"=>0,"G"=>0,"B"=>0));#border
/* Write the chart title */ /* Write the chart title */
$myPicture->setFontProperties(array("FontName"=>"fonts/Forgotte.ttf","FontSize"=>$fontsize,"R"=>255,"G"=>255,"B"=>255)); $myPicture->setFontProperties(array("FontName"=>"fonts/Forgotte.ttf","FontSize"=>$fontsize,"R"=>255,"G"=>255,"B"=>255));
$myPicture->drawText(10,16,"Durchschnittliche ".typeToFullName($type)." @ ".$date,array("FontSize"=>11,"Align"=>TEXT_ALIGN_BOTTOMLEFT)); $myPicture->drawText(10,16,"Durchschnittliche ".typeToFullName($type)." @ ".$date,array("FontSize"=>11,"Align"=>TEXT_ALIGN_BOTTOMLEFT));
$myPicture->drawText($width-200,16,"erzeugt @ ".date("H:i:s d.m.Y"),array("FontSize"=>11,"Align"=>TEXT_ALIGN_BOTTOMLEFT)); $myPicture->drawText($width-200,16,"erzeugt @ ".date("H:i:s d.m.Y"),array("FontSize"=>11,"Align"=>TEXT_ALIGN_BOTTOMLEFT));
@ -352,7 +352,7 @@ function baroLink($baselink,$selected=false){
} }
function calendarNav($month,$year){ function calendarNav($month,$year){
global $start_year_of_recordings; global $start_year_of_recordings;
$prevMonth=$prevYear=$nextMonth=$nextYear=0; $prevMonth=$prevYear=$nextMonth=$nextYear=0;
if($month==12){ if($month==12){
$prevMonth=$month-1; $prevMonth=$month-1;
@ -404,7 +404,7 @@ function drawCalendar($date,$type){
$today=array('match'=>($month==date("n") && $year==date("Y")),date("j"),date("n"),date("Y")); $today=array('match'=>($month==date("n") && $year==date("Y")),date("j"),date("n"),date("Y"));
$first=mktime(0,0,0,$month,1,$year); $first=mktime(0,0,0,$month,1,$year);
$firstDay=date("w",$first); $firstDay=date("w",$first);
$calendar="<div id='calendar'><br/>\n".calendarNav($month,$year); $calendar="<div id='calendar'><br/>\n".calendarNav($month,$year);
$day=1; $day=1;
#$day=0; #$day=0;
@ -478,4 +478,3 @@ function fileToLastSet($file){
$temp=explode(";",$last); $temp=explode(";",$last);
return $temp[0]; return $temp[0];
} }

View File

@ -66,6 +66,7 @@ if($mode==1){
}else{ }else{
$date=array($_GET['year'],$_GET['month'],$_GET['day']); $date=array($_GET['year'],$_GET['month'],$_GET['day']);
$future=false; $future=false;
#TODO: replace logic?
if($_GET['year']>$today[2]){ if($_GET['year']>$today[2]){
$future=true; $future=true;
}else{ }else{
@ -98,5 +99,3 @@ $runtime=microtime(true)-$start;
$html.="<div style='position:fixed;bottom:20px;right:50px;' >Runtime: ".$runtime." s</div>"; $html.="<div style='position:fixed;bottom:20px;right:50px;' >Runtime: ".$runtime." s</div>";
$html.=$calendar."</body>"; $html.=$calendar."</body>";
echo $html; echo $html;