SetX(10); // Set the starting y position $myBarGraph->SetY(10); // Set how wide the bargraph will be $myBarGraph->SetWidth($imageWidth-20); // Set how tall the bargraph will be $myBarGraph->SetHeight($imageHeight-20); // Set this to zero if you don't want to show any. These are the vertical // bars to help see the values. // $myBarGraph->SetNumOfValueTicks(3); // You can try uncommenting these lines below for different looks. // // The default is true. Setting this to false will cause phpBarGraph to not // print the labels of each bar. $myBarGraph->SetShowLabels(true); // The default is true. Setting this to false will cause phpBarGraph to not // print the values of each bar. $myBarGraph->SetShowValues(false); // The default is true. Setting this to false will cause phpBarGraph to not // print the border of each bar. $myBarGraph->SetBarBorder(true); // The default is true. Setting this to false will cause phpBarGraph to not // print each bar as a gradient. $myBarGraph->SetShowFade(true); // The default is true. Setting this to false will cause phpBarGraph to not // print the outside box. $myBarGraph->SetShowOuterBox(true); // The default is 10. This changes the space inbetween each bar. $myBarGraph->SetBarSpacing(5); // Add Values to the bargraph.. $result = pwg_query($query); $datas = array(); while ($row = mysql_fetch_array($result)) { $datas[$row['x']] = $row['y']; } if (!isset($min_x) and !isset($max_x)) { $min_x = min(array_keys($datas)); $max_x = max(array_keys($datas)); } for ($i = $min_x; $i <= $max_x; $i++) { if (!isset($datas[$i])) { $datas[$i] = 0; } $myBarGraph->AddValue($i, $datas[$i]); } // Set the colors of the bargraph.. // // This is the color on the top of every bar. $myBarGraph->SetStartBarColor("6666ff"); // This is the color on the bottom of every bar. This is not used when // SetShowFade() is set to false. $myBarGraph->SetEndBarColor("2222aa"); // This is the color all the lines and text are printed out with. $myBarGraph->SetLineColor("000000"); // Print the BarGraph to the image.. $myBarGraph->DrawBarGraph($image); Imagestring($image, 2, 2, $imageHeight-14, $legend, $white); //------------------------------------------------ Image output if ($outputFormat == "png") { header("Content-type: image/png"); ImagePNG($image); } else if (in_array($outputFormat, array("jpg", "jpeg"))) { header("Content-type: image/jpeg"); Imagejpeg($image); } // Destroy the image. Imagedestroy($image); ?>