<?
//Header("Content-type: image/png");
$day=$_GET["day"];
$maxcon=$_GET["maxcon"];
//if ($maxcon==0) return;

$conday=$_GET["conday"];


$larg=$day*30;
$long=$maxcon*30;

$image = imagecreate($larg+30,$long/2);

$noir = ImageColorAllocate($image,0,0,0); 
$vert = ImageColorAllocate($image,0,255,0);
$rouge = ImageColorAllocate($image,255,0,0);
$blanc = ImageColorAllocate($image,255,255,255);
$bleu = ImageColorAllocate($image,0,0,255);



$cont=(array) null;
$cont=explode("!",$conday);

$peak=(array) null;
$mean=(array) null;

for ($i=0;$i<count($cont)-1;$i++)
{
$tmp=(array) null;
$tmp=explode("@",$cont[$i]);
$date=$tmp[0];
$con=$tmp[1];

imageline($image,$larg/$day*($i+1),$long/2-10,$larg/$day*($i+1),0,$rouge);
//imagestring($image, 1,$larg/$day*($i+1)-25 ,$long-($con*20)-10,  $date, $blanc);
//imagestring($image, 1,$larg/$day*($i+1)-8 ,$long-($con*20)-20,  "($con)", $blanc);

//Rajout
$peak[count($peak)]=($larg/$day*($i+1))."@".(($long-($con*20)));

$mean[count($mean)]=($larg/$day*($i+1))."@".(($long-($con*20))/2);

}

//Rajout
for ($i=0;$i<count($mean)-1;$i++)
{

$tmp=(array) null;
$tmp=explode("@",$mean[$i]);
$X=$tmp[0];
$Y=$tmp[1];
$tmp2=(array) null;
$tmp2=explode("@",$mean[$i+1]);
$Xp=$tmp2[0];
$Yp=$tmp2[1];


imageline($image,$X,$Y,$Xp,$Yp,$bleu);


}


imageline($image,0,$long/2-10,$larg+30,$long/2-10,$blanc);




/*

$i=1;
$con=2;
imageline($image,$larg/$day*$i,$long,$larg/$day*$i,$long-($con*20),$rouge);
imagestring($image, 1,$larg/$day*$i-25 ,$long-($con*20)-10,  "26/01/2006", $blanc);
imagestring($image, 1,$larg/$day*$i-8 ,$long-($con*20)-20,  "($con)", $blanc);

$i=2;
$con=3;
imageline($image,$larg/$day*$i,$long,$larg/$day*$i,$long-($con*20),$rouge);
imagestring($image, 1,$larg/$day*$i-25 ,$long-($con*20)-10,  "27/01/2006", $blanc);
imagestring($image, 1,$larg/$day*$i-8 ,$long-($con*20)-20,  "($con)", $blanc);
*/








imagepng($image);


?>