Thanks a lot, your solution works for me. Just i am making the graph more attractive now, I am putting values on the top of each bar. But for some values when your run below code you will see like 30, 50 and 90 these numbers are not visible properly. And also i don't want 0 to show there. Can you please help me in this
#!/usr/bin/perl use strict; use GD; use GD::Graph::mixed; use GD::Graph::colour; use GD::Graph::bars; use GD::Graph::hbars; use GD::Graph::Data; use GD::Text; use GD::Graph::pie; #use GD::Font; my @data = ( ['Mon','-','Tues','-','Wed','-'], [10,0,40,0,80,0], [30,0,50,0,90,0], [0,100,0,60,0,30], [0,60,0,70,0,50], ); my @names = qw/sample15 sample15-h/; for my $my_graph (GD::Graph::bars->new, GD::Graph::hbars->new) { my $name = shift @names; print STDERR "Processing $name\n"; $my_graph->set( x_label => 'Days', y_label => 'CPU Utilization', y_min_value => 0, y_max_value => 200, #title => 'Stacked Bars (incremental)', cumulate => 1, #overwrite => 1, x_label_position => 1/3, #borderclrs => $my_graph->{dclrs}, dclrs => [ qw( green dgreen yellow dyellow ) ], transparent => 0, show_values => 1, values_space => 1, bar_spacing => 2, bargroup_spacing => 4, accent_treshold => 200, ); $my_graph->set_values_font('/usr/lib/perl5/5.8.8/fonts/nimbus_roman_ +i.pfb', 8); $my_graph->set_legend( qw(E-Avg E-Max T-Avg T-Max)); my $gd = $my_graph->plot(\@data); open(IMG, '>',$name.'.gif') or die $!; binmode IMG; print IMG $gd->gif; close IMG; }

In reply to Re^5: GD::Graph creating a clustered bar chart while some dataset are cumulative by huzefa52
in thread GD::Graph creating a clustered bar chart while some dataset are cumulative by huzefa52

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.