The problem may have something to do with the structure of your data. Does the following example work for you in displaying all 3 values for the legend?
use GD::Graph::hbars; use strict; use warnings; my @data = ( ['Jan', 'Feb', 'Mar', 'Apr'], [5, 7, 9, 6], [2, 2, 3, 1], [4, 4, 6, 3], ); my @legend = qw(maximum minimum average); my $graph = GD::Graph::hbars->new(600, 500); $graph->set ( x_label => 'Month', y_label => 'Value', title => 'GD::Graph::hbars example', bar_spacing => 6, show_values => 1, legend_placement => 'BL', legend_spacing => 5, show_values => 1, legend_marker_height => 12, dclrs => [ qw(orange cyan lred) ], ) or warn $graph->error; $graph->set_legend(@legend); my $gd = $graph->plot(\@data) or warn $graph->error; open(IMG, ">graph.png") or die $!; binmode IMG; print IMG $gd->png; close IMG;

In reply to Re: GD::Graph legend only shows 1 entry by randyk
in thread GD::Graph legend only shows 1 entry by bageler

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.