= $xmin) && ($var <= $xmax) ); } $newtime=array_filter($time,"monfiltre"); $newy1=array_intersect_key($y1,$newtime); $y1=array_values($newy1); if (!empty($field2)) { $newy2=array_intersect_key($y2,$newtime); $y2=array_values($newy2); } $time=array_values($newtime); } $width=800; $height=600; header("Content-type: image/png"); header("Content-Disposition: inline; filename=\"$title.png\""); $graph = new Graph($width, $height, "auto"); $graph-> img-> SetImgFormat("png"); $graph->SetScale("datlin",$y1min,$y1max,$xmin,$xmax); $graph->img->SetMargin(80,80,40,80); $graph->SetClipping(true); $graph->SetFrame(false); $graph->SetBox(true); $graph->SetGridDepth(DEPTH_BACK); //$graph->SetAxisStyle(AXSTYLE_BOXOUT); $graph->SetTickDensity(TICKD_NORMAL,TICKD_VERYSPARSE); $graph->title->Set($title); $graph->title->SetFont(FF_ARIAL,FS_BOLD,12); $graph->xaxis->title->Set("Time"); $graph->xaxis->title->SetFont(FF_ARIAL,FS_NORMAL,12); $graph->xaxis->SetTitlemargin(50); $graph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,10); $graph->xaxis->SetLabelAngle(45); $graph->xaxis->SetPos("min"); $datemin=getdate($xmin); $datemax=getdate($xmax); if (($xmax-$xmin)<5*60) { // $graph->xaxis->scale->SetTimeAlign(MINADJ_1); if ($datemin['day']==$datemax['day']) $graph->xaxis->scale->SetDateFormat( 'H:i:s'); else $graph->xaxis->scale->SetDateFormat( 'd/m H:i:s'); } elseif (($xmax-$xmin)<6*60*60) { // $graph->xaxis->scale->SetTimeAlign(HOURADJ_1); if ($datemin['day']==$datemax['day']) $graph->xaxis->scale->SetDateFormat( 'H:i'); else $graph->xaxis->scale->SetDateFormat( 'd/m H:i'); } elseif (($xmax-$xmin)<7*24*60*60) { // $graph->xaxis->scale->SetDateAlign(DAYADJ_1); if ($datemin['year']==$datemax['year']) $graph->xaxis->scale->SetDateFormat( 'd/m H:i'); else $graph->xaxis->scale->SetDateFormat( 'd/m/Y H:i'); } else { if ($datemin['year']==$datemax['year']) $graph->xaxis->scale->SetDateFormat( 'd/m'); else $graph->xaxis->scale->SetDateFormat( 'd/m/Y'); } $graph->xaxis->SetLabelSide(SIDE_DOWN); $graph->xaxis->SetTickSide(SIDE_DOWN); $graph->xgrid->Show(); $graph->yaxis->title->Set("$field1"); $graph->yaxis->title->SetFont(FF_ARIAL,FS_NORMAL,12); $graph->yaxis->SetTitlemargin(50); $graph->yaxis->SetFont(FF_ARIAL,FS_NORMAL,10); //$graph->yaxis->SetLabelAngle(0); $graph->yaxis->SetLabelSide(SIDE_LEFT); $graph->yaxis->SetTickSide(SIDE_LEFT); if ( !empty($_GET['style1']) && $_GET['style1']=='line') { $lineplot =new LinePlot($y1,$time); $lineplot ->SetColor("blue"); $lineplot->SetWeight(2); $graph->Add( $lineplot); } elseif ( !empty($_GET['style1']) && $_GET['style1']=='point') { $scatterplot= new ScatterPlot($y1,$time); $scatterplot->mark->SetColor("blue"); $scatterplot->mark->SetType(MARK_FILLEDCIRCLE); $scatterplot->mark->SetSize(2); $graph->Add( $scatterplot); } else { $scatterplot= new ScatterPlot($y1,$time); $scatterplot->mark->SetColor("blue"); $scatterplot->mark->SetType(MARK_FILLEDCIRCLE); $scatterplot->mark->SetSize(2); $graph->Add( $scatterplot); } $graph->yaxis->SetColor("blue"); $graph->yaxis->title->SetColor("blue"); if (!empty($field2)) { $graph->SetY2Scale("lin",$y2min,$y2max); $graph->y2axis->title->Set("$field2"); $graph->y2axis->title->SetFont(FF_ARIAL,FS_NORMAL,12); $graph->y2axis->SetTitlemargin(50); $graph->y2axis->SetFont(FF_ARIAL,FS_NORMAL,10); //$graph->y2axis->SetLabelAngle(0); $graph->y2axis->SetLabelSide(SIDE_RIGHT); $graph->y2axis->SetTickSide(SIDE_RIGHT); if ( !empty($_GET['style2']) && $_GET['style2']=='line') { $lineplot2 =new LinePlot($y2,$time); $lineplot2->SetColor("orange"); $lineplot2->SetWeight(2); $graph->AddY2( $lineplot2); } elseif ( !empty($_GET['style2']) && $_GET['style2']=='point') { $scatterplot2= new ScatterPlot($y2,$time); $scatterplot2->mark->SetColor("orange"); $scatterplot2->mark->SetFillColor("orange"); $scatterplot2->mark->SetType(MARK_FILLEDCIRCLE); $scatterplot2->mark->SetSize(2); $graph->AddY2( $scatterplot2); } else { $scatterplot2= new ScatterPlot($y2,$time); $scatterplot2->mark->SetColor("orange"); $scatterplot2->mark->SetFillColor("orange"); $scatterplot2->mark->SetType(MARK_FILLEDCIRCLE); $scatterplot2->mark->SetSize(2); $graph->AddY2( $scatterplot2); } $graph->y2axis->SetColor("orange"); $graph->y2axis->title->SetColor("orange"); } $graph->Stroke(); ?>