senget76 has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks I was able to generate graph from a dynamic set of data using GD:Graph module. However, I have other problem regarding the legend. I am not sure how to set the legend since the name of the legends is also dynamic. I try to pass an array, but the program returns the array location
@temp_legend[0]="name1"; @temp_legend[1]="name2"; @temp_legend[2]="name3"; $graph->set_legend(@temp_legend);
I hope somebody could help me out thank you

Edit: Added <code> tags. larsen

Replies are listed 'Best First'.
Re: GD::Graph legend issues
by robartes (Priest) on Nov 25, 2002 at 08:46 UTC
    I don't quite follow what you mean by 'the program returns the array location', but a mistake in the code snippet above is how you assign values to array elements. In this case, your array elements are scalars, so you assign values thusly:
    $temp_legend[0]="name1"; $temp_legend[1]="name1"; $temp_legend[2]="name3";
    BTW, you should put <code> tags around your code, that way the [] don't get eaten.

    CU
    Robartes-