in reply to Coaking GDGraph to work...

You have to use an array of arrays:
my @data = ( ["1st","2nd","3rd","4th","5th","6th","7th", "8th", "9th"], [ 1, 2, 5, 6, 3, 1.5, 1, 3, 4], [ sort { $a <=> $b } (1, 2, 5, 6, 3, 1.5, 1, 3, 4) ] );
The first array contains the X-values, and the rest of the arrays contain the Y-values to be plotted. After that, you do something like this: (untested)
# Create GD::Graph object my $graph = GD::Graph->new(400, 300); # Optionally set graph attributes $graph->set(x_label => "X Label", y_label => "Y Label"); # Create the graph itself my $gd = $graph->plot(\@data); # And output the file on STDOUT (redirect to a file, # or open a file yourself print $gd->png;

Most of this comes from the excellent GD::Graph documentation. Read it :-)

Arjen

Replies are listed 'Best First'.
Re: Re: Coaking GDGraph to work...
by zakzebrowski (Curate) on Feb 04, 2003 at 14:24 UTC
    Yes, I read the doc, but actually *getting* to the array of array parts was the problem... The numbers were not constant so I could not manually create the array... the answer below yours was the one I was looking for, thanks. :)

    ----
    Zak
    Pluralitas non est ponenda sine neccesitate - mysql's philosphy