Since I don't have root access to my server I'm limited in what modules 
are available (without nagging the admin folks).  I use GD and roll my 
own charting code.  I'd love to have access to GD::Graph and 
GD::Graph::3D, but that's the way it goes.

I've created bar, column and 'radar' charts via this manner, with a 
fair amount of success.

Let me recommend you take your time in developing a chart using 
'relative' coding (i.e. the center of the chart is $x0 = 
$chart_width/2) so that you only have to actually set a few parameters 
(height, width, etc) and thus reworking the code will be far simpler.

In a recent project I fed the maximum value (maxvalue) of a column (say 
'50') and the height and width.  I set a general margin (leftmargin) of 
..025.   I knew I wanted a footer area to show a legend, etc., so I 
multiplied Height by .20 (to have a footer 20% the height of the 
graphic area - then took that (availHeight) and divided it by maxValue. 
  That gave me a multiplier which I applied to all of the incoming 
values that had to be plotted.  @scores is the array holding the values 
to be plotted.  There are some other values set that give the leftmost 
edge of the next column, the width of the column and the color.

$leftmargin = $width * $margins;
$baseline = $height - ($height * $footer);
$maxbar = $c_baseline - $leftmargin;

$multiplier = $maxbar / $maxvalue;

for each $score {
   my $scoresgraphed[$i] = $scores[$i] * $multiplier;       # need to 
keep actual score.
   ImageFilledRectangle($chart, $leftmost, $baseline - 
$scoresgraphed[$i],
       $leftmost + $colwidth, $baseline, $color);
}

In this case if the client wants a 400x300 graphic instead of a 
460x400, all I have to do is change two numbers.  In fact, I started 
doing that via the URL, so all I have to change is the call.

You can see a simple example of GD as a graphing program by going to:

http://www.imaworldwide.com/goto/online_assessments

and try the free "Stress Test".  Just make some random choices, unless 
you REALLY want to know just how stressed you are.

Nelson



Nelson


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to