use strict; use warnings; use GD; use GD::Graph::bars; my $img_width = 288; my $img_height = 216; my $number_of_hours = 24; my $img = GD::Image->new($img_width, $img_height); my $gifdata = $img->gifanimbegin(1,0); foreach my $hour (0..$number_of_hours-1) { my @h = CreateHistogram($hour); my @labels = 0..79; my @data = (\@labels, \@h); my $graph = GD::Graph::bars->new($img_width,$img_height); $graph->set( title => "HISTOGRAM HOUR $hour" ); my $gd = $graph->plot(\@data); $gifdata .= $gd->gifanimadd; open(FIL, ">image_$hour.gif"); binmode FIL; print FIL $gd->gif; close FIL; } $gifdata .= $img->gifanimend; open(GIF,">image.gif"); print GIF $gifdata; close GIF; exit; sub CreateHistogram { # stuff to create a histogram }