html - create a pie chart using php -
i saw tutorial online claim code below makes pie chart. yet when run exact code have error fatal error: call undefined function imagecolorsallocate() in /**/**/*/piechart.php on line 7 (i've used asterix cover folders names). suggestions? or there other way create 1 preferably without using third party material.
<?php //create image $image = imagecreatetruecolor(100,100); //allocate colour $white = imagecolorsallocate($image, 0xff , 0xff, 0xff); $gray = imagecolorsallocate($image, 0xc0 , 0xc0, 0xc0); $darkgray = imagecolorsallocate($image, 0x90 , 0x90, 0x90); $navy = imagecolorsallocate($image, 0x00 , 0x00, 0x80); $darknavy = imagecolorsallocate($image, 0x00 , 0x00, 0x05); $red = imagecolorsallocate($image, 0xff , 0x00, 0x00); $darkred = imagecolorsallocate($image, 0x90, 0x00, 0x00); //make 3d effect for($i = 60; $i >50; $i--){ imagefilledarc($image, 50, $i, 100, 50, 0, 45, $darknavy, img_arc_pie); imagefilledarc($image, 50, $i, 100, 50, 45, 75, $darkgray, img_arc_pie); imagefilledarc($image, 50, $i, 100, 50, 75, 360, $darkred, img_arc_pie); } imagefilledarc($image ,50 ,50 , 100, 50, 0, 45, $navy, img_arc_pie); imagefilledarc($image ,50 ,50 , 100, 50, 45, 75, $gray, img_arc_pie); imagefilledarc($image ,50 ,50 , 100, 50, 75, 360, $red, img_arc_pie); //flush image header('content-type: image/png'); imagepng($image); imagedestroy($image); ?>
thanks
it should of been imagecolourallocate not imagecoloursallocate. not of been spotted if not class
Comments
Post a Comment