#!/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; }