1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| use GD::Graph::bars;
use strict;
# arguments : deux pointeurs vers des tableaux anonymes de même taille
my @data = (["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec"],
[23, 5, 2, 20, 11, 33, 7, 31, 77, 18, 65, 52]);
my $mygraph = GD::Graph::bars->new(500, 300);
$mygraph->set(
x_label => 'Month',
y_label => 'Number of Hits',
title => 'Number of Hits in Each Month in 2002',
) or warn $mygraph->error;
my $myimage = $mygraph->plot(\@data) or die $mygraph->error;
open(IMG, '>f1.png') or die $!;
binmode IMG;
print IMG $myimage->png; |
Partager