\n";
$width = 800;
$height = 300;
//find max of answers to set max of x-axis, max of y-axis is always seven, because there are six possibilities to answer
$values = $question;
array_shift($values);
$maxX = max($values)+1;
$maxY = 7;
$img = CreateImage($width, $height);
// the amount of answers for the different options and a nice group of bars
for ($i = 1; $i < 7; $i++)
{
echo "
\n";
$green = 150*($question[$i]/$maxX) + 40;
$color = ImageColorAllocate($img, 0.57 * $green, $green, 0.45 * $green);
DrawBar($img, $question[$i], $maxX, $i+1, $maxY, $question[$i], $color);
}
//finish image and save it
$caption = array("N/A","--","-", "0", "+", "++");
DrawCoords($img, $maxX, $maxY, $caption);
$file=str_replace("?", "", str_replace(" ", "", $question[0]));
ImagePNG($img,"question".$file.".png");
ImageDestroy($img);
echo "