rajbal Posted January 24, 2007 Share Posted January 24, 2007 Hi All, I have plotted the bar graph using imageline,imagefilledrectangle,imagepng functions in php.I want to display the x axis and y axis coordinate values on the Bar graph.Can anyone help me on this?Also i am attaching the script here:<?// Add values to the graph$graphValues=array(0,80,23,11,190,245,50,80,111,240,55);// Define .PNG imageheader("Content-type: image/png");$imgWidth=250;$imgHeight=250;// Create image and define colors$image=imagecreate($imgWidth, $imgHeight);$colorWhite=imagecolorallocate($image, 255, 255, 255);$colorGrey=imagecolorallocate($image, 192, 192, 192);$colorDarkBlue=imagecolorallocate($image, 104, 157, 228);$colorLightBlue=imagecolorallocate($image, 184, 212, 250);// Create border around imageimageline($image, 0, 0, 0, 250, $colorGrey);imageline($image, 0, 0, 250, 0, $colorGrey);imageline($image, 249, 0, 249, 249, $colorGrey);imageline($image, 0, 249, 249, 249, $colorGrey);// Create gridfor ($i=1; $i<11; $i++){imageline($image, $i*25, 0, $i*25, 255, $colorGrey);imageline($image, 0, $i*25, 255, $i*25, $colorGrey);}// Create bar chartsfor ($i=0; $i<10; $i++){imagefilledrectangle($image, $i*25, (250-$graphValues[$i]), ($i+1)*25, 250, $colorDarkBlue);imagefilledrectangle($image, ($i*25)+1, (250-$graphValues[$i])+1, (($i+1)*25)-5, 248, $colorLightBlue);}// Output graph and clear image from memoryimagepng($image);imagedestroy($image);?>Regards,Raj Link to comment https://forums.phpfreaks.com/topic/35448-display-text-on-the-x-and-y-axis-of-the-bar-graph/ Share on other sites More sharing options...
Cagecrawler Posted January 24, 2007 Share Posted January 24, 2007 A series of imagettftext() functions? Link to comment https://forums.phpfreaks.com/topic/35448-display-text-on-the-x-and-y-axis-of-the-bar-graph/#findComment-167740 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.