I've been reading up on it, and working backwards from the final product in an effort to determine what we require, where. A work in progress. --
gummAY
What do we need to do with GD to make pretty images?
include the library, a php module in our case, probably done in php.ini
declare the image
gdImagePtr <name>;
Allocate the image size.
<name> = gdImageCreate(pxaccross, pxtall)
Make the background colour (First colour GD sees is background -- what do we want?)
background = gdImageColourAllocate(<name>, red, green, blue)
define a colour for the link line, try green
green = gdImageColourAllocate(<name>, 0, 255, 0)
Now, the link line itself is drawn, using px values
gdImageLine(<name>, x1, y1, x2, y2, green);
This is where we want our input.
x1 and x2, the horizontal values probably won't change, they'll be stuck a few pixels in from the border, and there they'll stay.
y1 & 2 are our elevation data, calculated down into pixels.
Next, we want to draw a filled in polygon, for our elevation diagram....
First, define how many points in the polygon -- we need to find this out beforehand. There will always be at least three. Bottom left, MIddle and Bottom Right
gdPoint points
we declare the points
Y is agian the elevation data, translated into pixels, xn is the point at which the elevation changes. We can either find this out, or sample at predefined (small) intervals.
points[0.x = x0;
points
0.y = y0;
points
1.x = x1;
points
1.y = y1;
points
2.x = x2;
points
2.y = y2;
and so on
We want it black, so define black
black = gdImageColorAllocate(im, 0, 0, 0);
then paint it black
gdImageFilledPolygon(<name>, points, #, black);
Now, throw the file into a png
gdImagePng(<name>, <output pointer>);