<?php
$graphValues=array(0,80,23,11,190,245,50,80,111,240,55,0,250,30,45,20); // de punten van de grafiek
$imgWidth=400; // breedte van de grafiek (komt 1 bij, best altijd met 25*x vermeerderen!)
$imgHeight=250; // hoogte van de grafiek (komt 25 bij, ook best atlijd met 25*y vermeerderen!)

header("Content-type: image/png");

$image=imagecreate($imgWidth+1, $imgHeight+25);

$colorWhite = imagecolorallocate($image, 255, 255, 255); // achtergrond
$colorGrey = imagecolorallocate($image, 192, 192, 192); // kleur van het rooster op de achtergrond
$colorBlue = imagecolorallocate($image, 0, 0, 255); // kleur van de lijn

// rand maken (buitenkant)
imageline ($image, 25, 0, 25, $imgHeight, $colorGrey);
imageline ($image, 25, 0, $imgWidth, 0, $colorGrey);
imageline ($image, $imgWidth, 0, $imgWidth, $imgHeight, $colorGrey);
imageline ($image, 25, $imgHeight, $imgWidth, $imgHeight, $colorGrey);

// kader op bg maken
for ($i = 1; $i < 16; $i++){
	// horizontale nummers en lijnen
	imageline ($image, 25, $i*25, $imgWidth+25, $i*25, $colorGrey);
	$max = 12; //11 + 1
	if ($i < $max)
		imagestring ($image, 10, 0, ($i*25)-30, ($max-$i), $colorGrey);
		
	// verticale nummers en lijnen
	imageline ($image, $i*25, 0, $i*25, $imgHeight, $colorGrey);
	if ($i < 16)
		imagestring ($image, 10, ($i*25)-5, $imgHeight, $i, $colorGrey);
}

for ($i = 0; $i < (count($graphValues)-1); $i++) // lijn op grafiek tekenen
	imageline ($image, ($i*25)+25, ($imgHeight-$graphValues[$i]), (($i+1)*25)+25, ($imgHeight-$graphValues[$i+1]), $colorBlue);

imagepng ($image);
imagedestroy ($image);
?> 