GD(help)....

I have been fiddling with this my perl GD:Graph prog and just can't get it
to work, get the following error can anyone help???

I have managed to successfully plot a graph previously what am I doing
wrong?
-----------------------------------------------------------
Illegal division by zero at
/home/zzchesh/perl/lib/site_perl/5.6.1/GD/Graph/axestype.pm line 1176,
<INFILE> line 858.
-----------------------------------------------------------
Here is a stdout of my array of array which the GD::Graph uses as its data
sets.
=----------------------------------------------------------
Welsh emigrants' letters
 Benllech Congregational Chapel Minute Books
 Papers of Owen Lewis, Arthog
 World War II Newspapers
 Hugh Derfel Hughes Papers

6
 5
 4
 4
 4
------------------------------------------------------------
HERE IS MY PROGRAM :-


#!/home/zzchesh/perl/bin/perl -w

# Reads in stats from all html tables in the Hub_Stat directory, produces a
graph on the top ten searches on the Hub

#use strict;
#use GD::Graph::Data;
use GD::Graph::bars;
#use GD::Graph::pie;
#use GD::Graph::lines;
#use GD::Graph::points; #
#use GD::Text; #

for $file (<*02.html>){
  open (INFILE, "/home/zzchesh/WWW/docs/Hub_Stats/$file") or die "there is
no file $!" ;

  while ($line = <INFILE>){

      #chomp $line;

        if ($line =~ /<td headers="header2">(.*?)<\/td>/i){ # Record name
          $name = $1;
          chomp $name;
          $name .= "\n";
          #push (@title, $name);

        }

        if ($line =~ /<td headers="header3">(.*?)<\/td>/i){ # Search frequency
          $num = $1;
          chomp $num;
          $num .= "\n";
          #push (@searches, $num);
        }

        $hash{$name} = $num;

      }
}

foreach $name(sort { $hash{$b} <=> $hash{$a} } keys (%hash)){ #compares
  if ($count < 5){
    #print "The Key  is $name and the value is: $hash{$name}\n";
    push @title, $name;
    push @searches, $hash{$name};
    #print $hash{$name};
    #print $name;
   $count ++;
  }



}

push @graph_data, [ @searches];
push @graph_data, [ @title];

$graph = GD::Graph::bars->new(750, 400);
$graph->set ( x_labels_vertical => 1);

$graph->set(
            x_label => 'TITLE',
            y_label => 'NO. of SEARCHES',
            title => 'TOP TEN RECORDS FOR MARCH 2002',
            bar_spacing => 20,
            bar_width => 20,
           # y_min_value => 0,
           # y_max_value => 15
           )
  or warn $graph->error;



print "##########TITLE @title#####################\n";
print "############## SEARCHES @searches################\n";
#print "@title\n";
#print "@searches\n";
#print "$name\n";

#$graph->wanted(1,2,3,4,5,6,7,8,9,10) or die $data->error;
$graph->plot(\@graph_data) or die $graph->error;

open (GRAPH, ">Topsearches.jpg") || die "Cannot open Topsearches.jpg: $!\n";
print GRAPH $graph->gd->jpeg(200);

print "@searches\n";
print "@title\n";
#print "$num";
$count =0;

close (INFILE);




Steve Tattersall
Archives Hub Programmer
MIMAS
Manchester Computing
Oxford Road
Manchester
M13 9PL
Tel: 0161 275 6054

[EMAIL PROTECTED]


Reply via email to