Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^5: GD::Graph creating a clustered bar chart while some dataset are cumulative

by poj (Priest)
on Aug 28, 2013 at 20:33 UTC ( #1051315=note: print w/ replies, xml ) Need Help??


in reply to Re^4: GD::Graph creating a clustered bar chart while some dataset are cumulative
in thread GD::Graph creating a clustered bar chart while some dataset are cumulative

If you want different colours then you could create a 4 stack bar but use only 2 of the stack, the other 2 set to zero and alternate the 2 used. For example ;

#!perl use GD::Graph::bars; use GD::Graph::hbars; my @data = ( ['Mar1','Mar2','Apr1','Apr2','May1','May2'], [1,0,2,0,4,0], [2,0,1,0,5,0], [0,3,0,3,0,6], [0,4,0,4,0,7], ); 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 => 'X Label', y_label => 'Y label', title => 'Stacked Bars (incremental)', cumulate => 1, overwrite => 1, borderclrs => $my_graph->{dclrs}, bar_spacing => 5, transparent => 0, ); $my_graph->set_legend( qw(A B C D)); my $gd = $my_graph->plot(\@data); open(IMG, '>',$name.'.gif') or die $!; binmode IMG; print IMG $gd->gif; close IMG; }
poj


Comment on Re^5: GD::Graph creating a clustered bar chart while some dataset are cumulative
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1051315]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (13)
As of 2014-09-19 15:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (142 votes), past polls