in reply to GD Graph Question
I am assuming that this is due to the fact the @data has no data?? Here's my new codeCan't call method "png" on an undefined value at ./graph.pl line 35.
Any suggestions would be greatly appreciated. TIA, liquid#!/usr/bin/perl -w use GD::Graph::lines3d; use DBI; $sql = "select day, count(day) as day_total from tec_event_data where +month='Feb' group by day order by day asc"; $db = DBI->connect('dbi:Oracle:tec.world','tec','tectec') or die "Unab +le to connect: $DBI::errstr"; $sth = $db->prepare( $sql ); $sth->execute; while (($day,$events) = $sth->fetchrow_array) { push (@days, $day); push (@events, $events); } $sth->finish; my @data = (@days,@events); #for ($x=0;$x<=$#data;$x++) { # print "$data[$x]\n"; #} $graph = new GD::Graph::lines3d( 600, 400 ); $graph->set( x_label => 'Months', y_label => 'Number of Events', title => 'Monthly Events by Day' ); $gd = $graph->plot( \@data ); $format = $graph->export_format; open (IMG, ">/usr/tivoli/TSE/httpd/docs/images/test.$format") or die $ +!; binmode IMG; print IMG $gd->$format(); close IMG; $db->disconnect;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: GD Graph Question
by liquidc00l (Novice) on Feb 20, 2002 at 17:45 UTC |