我正在使用该GD::Graph
模块。我需要在图表上的每列上方写入该列对应的值。我该怎么做?
#!/usr/bin/perl
use strict;
use warnings;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use GD::Graph::bars3d;
sub stringToDec {
my $ustring = '';
for my $char (split //, shift){
if(ord($char)>127){
$ustring .= "&#" . (unpack("U", $char)+848) . ";";
} else {
$ustring .= $char;
}
}
return $ustring;
}
my @time = ('00:00', '03:00', '06:00', '09:00', '12:00', '15:00');
my @site1 = ( 80 , 30 , 15 , 40 , 250 , 340 );
my @data = (\@time, \@site1);
my $graph = GD::Graph::bars3d->new(800, 300);
$graph->set_title_font('arial.ttf', 9);
$graph->set_y_label_font('arial.ttf', 9);
$graph->set_legend_font('arial.ttf', 9);
$graph->set(
y_label => 'Кол-во',
title => 'Кол-во подключенных по месяцам',
dclrs => [ ('green', 'blue') ],
bar_spacing => 15,
) or warn $graph->error;
$graph->set_legend('LAN', 'Ч.сектор');
my $image = $graph->plot(\@data) or die $graph->error;
print "Content-type: image/png\n\n";
print $image->png;