[Gllug] [Fwd: GD::Graph question]

Adrian McMenamin adrian at newgolddream.dyndns.info
Sat Nov 11 23:02:19 UTC 2006


I asked this on the London perl mongers list and got no reply... I think
it's a bit too specialist for here, but I thought I might as well try...

-------- Forwarded Message --------
From: Adrian McMenamin <adrian at newgolddream.dyndns.info>
Reply-To: London.pm Perl M[ou]ngers <london.pm at london.pm.org>
To: London.pm Perl M[ou]ngers <london.pm at london.pm.org>
Subject: GD::Graph question
Date: Sat, 11 Nov 2006 20:58:32 +0000

Apologies if this sort of question isn't appropriate to the list - it's
hard to tell from the archives.

I have used GD::Graph::pie without problems but I cannot get it to draw
a line graph.

Here is the main bit of code...

print "Content-type: image/png\n\n";


$GD::Graph::Error::Debug = 5;

my $graph = GD::Graph::lines->new($xrange, $yrange);

$graph->set(title => $formdata{"title"},
            label => $formdata{"label"},
            x_label => "X",
            y_label => "Y",
            );

@data = (["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12",
"13", "14", "15", "16", "17", "18", "19", "20"], [$votes[0], $votes[1],
$votes[2], $votes[3], $votes[4], $votes[5], $votes[6], $votes[7],
$votes[8], $votes[9], $votes[10], $votes[11], $votes[12], $votes[13],
$votes[14], $votes[15], $votes[16], $votes[17], $votes[18],
$votes[19] ]);

my $gd_text = GD::Text->new();
$graph->set_title_font(gdLargeFont, 18);


print $graph->plot(\@data)->png or die $graph_error;

exit(0);


I just get this...

[Sat Nov 11 20:57:23 2006] [error] [client 81.1.88.190] Use of
uninitialized value in subroutine entry at /usr/lib/perl5/GD.pm line
169.
[Sat Nov 11 20:57:23 2006] [error] [client 81.1.88.190] Use of
uninitialized value in subroutine entry at /usr/lib/perl5/GD.pm line
169.
[Sat Nov 11 20:57:23 2006] [error] [client 81.1.88.190] Use of
uninitialized value in subtraction (-)
at /usr/local/share/perl/5.8.4/GD/Graph/axestype.pm line 432.
[Sat Nov 11 20:57:23 2006] [error] [client 81.1.88.190] Use of
uninitialized value in subtraction (-)
at /usr/local/share/perl/5.8.4/GD/Graph/axestype.pm line 513.
[Sat Nov 11 20:57:23 2006] [error] [client 81.1.88.190] Can't call
method "png" on an undefined value
at /usr/lib/cgi-bin/hatetories/scoregraph.pl line 87.

I cannot see what i am doing wrong here and the error message doesn't
amount to much

-------------- next part --------------
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug


More information about the GLLUG mailing list