filledpolygon

GD and GD2 are useful libraries for creating graphics on-the-fly. Discuss your PHP GD and GD2 scripts here.

Moderators: onion2k, General Moderators

Post Reply
sandy1028
Forum Commoner
Posts: 60
Joined: Thu Jul 26, 2007 3:56 am

filledpolygon

Post by sandy1028 »

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


Code: Select all

// 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);
}

User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

You are only giving imagefilledpolygon() two points. That's not a polygon.
Post Reply