Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with GD of PERL

Status
Not open for further replies.

benaam

Programmer
Jan 11, 2001
20
US
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 qw:)standard);

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top