HI,
I am drawing a bar graph with 6 bars using GD of PERL.
I am even displaying the values on top of the graphs.
My code is as follows:
#!/usr/local/bin/perl5
use GD::Graph::bars;
use CGI qwstandard);
my $cgi = new CGI;
my $title = $cgi->param('title');
#$title="Bar Graph";
@y1data = split(/,/, $y1);
@y2data = split(/,/, $y2);
@data = (
['A','B','C'],
[10.2,11.2,12.0]
);
print header("image/gif"
$my_graph = new GD::Graph::bars(400,300);
$my_graph->set_values_font(GD::Font->Tiny);
$my_graph->set_x_label_font(GD::Font->MediumBold);
$my_graph->set_y_label_font(GD::Font->MediumBold);
$my_graph->set(
zero_axis_only => 0,
bar_spacing => 3,
long_ticks => 0,
show_values => 1,
values_vertical => 0,
value_space => 0,
x_labels_vertical => 1,
labelclr => 'dbrown',
dclrs => ['red'],
x_label_position => 1/2,
y_tick_number => 3,
axislabelclr => 'lpurple',
);
$my_graph->plot(\@data);
$ext = $my_graph->export_format;
print $my_graph->gd->$ext();
But the problem I am getting is for the last value that is displayed above the graph ie 12.0 I am getting some junk characters beside the value.
Can I know the solution please?
Cheers,
Benaam
I am drawing a bar graph with 6 bars using GD of PERL.
I am even displaying the values on top of the graphs.
My code is as follows:
#!/usr/local/bin/perl5
use GD::Graph::bars;
use CGI qwstandard);
my $cgi = new CGI;
my $title = $cgi->param('title');
#$title="Bar Graph";
@y1data = split(/,/, $y1);
@y2data = split(/,/, $y2);
@data = (
['A','B','C'],
[10.2,11.2,12.0]
);
print header("image/gif"
$my_graph = new GD::Graph::bars(400,300);
$my_graph->set_values_font(GD::Font->Tiny);
$my_graph->set_x_label_font(GD::Font->MediumBold);
$my_graph->set_y_label_font(GD::Font->MediumBold);
$my_graph->set(
zero_axis_only => 0,
bar_spacing => 3,
long_ticks => 0,
show_values => 1,
values_vertical => 0,
value_space => 0,
x_labels_vertical => 1,
labelclr => 'dbrown',
dclrs => ['red'],
x_label_position => 1/2,
y_tick_number => 3,
axislabelclr => 'lpurple',
);
$my_graph->plot(\@data);
$ext = $my_graph->export_format;
print $my_graph->gd->$ext();
But the problem I am getting is for the last value that is displayed above the graph ie 12.0 I am getting some junk characters beside the value.
Can I know the solution please?
Cheers,
Benaam