sandy1028 Posted September 24, 2007 Share Posted September 24, 2007 This code creates the line graph. I want to fill the color from start to end point of line graph. I tried using the imagefilledpolygon but I am not able to pass the array of values. Please help me with this // Create line graph for ($i=0; $i<$count; $i++){ $graphValues[$i]=round(($graphValues[$i]*$yheight)/$max,2); } for($i=0;$i<$count;$i++){ imageline($image,40+$i*$xinc,(40+125-$graphValues[$i]),40+($i+1)*$xinc,(40+125-$graphValues[$i+1]),$colorBlue); imagefilledpolygon($image,array(40,$graphValues[$i+1],165,$graphValues[$i]),$count,$black); } Quote Link to comment https://forums.phpfreaks.com/topic/70443-filled-polygon/ Share on other sites More sharing options...
Barand Posted September 24, 2007 Share Posted September 24, 2007 [pre] x5,y5 /| / | x3,y3 / | /\ / | / \ / | x2,y2 / \/ | | x4,y4 | |____________| x5,y1 x2,y1 [/pre] the array would be (x2,y1,x2,y2,x3,y3,x4,y4,x5,y5,x5,y1) Build the array as you plot the points and call imagefilled polygon after the loop Quote Link to comment https://forums.phpfreaks.com/topic/70443-filled-polygon/#findComment-353919 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.