for($date){
($h,$m,$s)=split/:/;
s/\:\d\d$//; #throw out the seconds, we don't need them
$m="00" if ($m<15);
$m="15" if (($m>=15) && ($m<30));
$m="30" if (($m>=30) && ($m<45));
$m="45" if ($m>=45);
s/\:\d\d\/\:$m/; #replace the minutes with the generalized value
}
####
$parseddata{$date}++ unless grep{$_ eq "$date|$session"}@seen;
push @seen,"$date|$session";
####
my @keys = sort keys %parseddata;
my @values;
for(@keys){
push @values,$parseddata{$_};
}
my @data=([@keys],[@values]);
my $graph=GD::Graph::area->new(1000,600);
#set all the graph options(labels, colors etc...)
my $gd = $graph->plot(\@data);
open(GRAPH, ">/graphs/$datestamp.png) or die "Can't open output file for graph: $!";
binmode GRAPH;
print GRAPH $gd->png;