liu has asked for the wisdom of the Perl Monks concerning the following question:

i am trying to use map with an image created by Graph::pie(), it seems it does not work with MAP, and when i change the type to graph::Bar(), certainly for the same datas,it works well, how can i do?
Use of uninitialized value in addition (+) at /usr/local/lib/perl5/sit +e_perl/5.6.1/GD/Graph/pie.pm line 441. Use of uninitialized value in addition (+) at /usr/local/lib/perl5/sit +e_perl/5.6.1/GD/Graph/pie.pm line 441. Use of uninitialized value in numeric lt (<) at /usr/local/lib/perl5/s +ite_perl/5.6.1/GD/Graph/Map.pm line 305.

Replies are listed 'Best First'.
Re: Problem using GD::Graph::MAP with Graph::pie
by davido (Cardinal) on May 10, 2004 at 16:17 UTC
    Post 10-30 lines of code that replicate the problem so we know what you're talking about.

    In some cases an error message is sufficient. But in this case, we really need to know what you're doing. I can't tell from your description.


    Dave

      i have posted the code after the question, if you have some ideas, please help me, thank you very much
Re: Problem using GD::Graph::MAP with Graph::pie
by matija (Priest) on May 10, 2004 at 16:21 UTC
    It's a bit hard to guess what's going wrong without seeing any of your code whatsoever. For instance, is the @hrefs set up the way it should be?
Re: Problem using GD::Graph::MAP with Graph::pie
by liu (Initiate) on May 10, 2004 at 16:27 UTC
    my @data = ( ["1st","2nd","3rd","4th","5th","6th"], [ 4, 2, 3, 4, 3, 3.5] ); my @hrefs = ["http://www.perl.org", "http://www.cpan.org", "http://fre +shmeat.net", "javascript:alert('Example of using JavaScript');","http +://www.perl.org","http://www.perl.org"] my $my_graph = new GD::Graph::pie(); $my_graph->set( title => 'A Pie Chart', label => 'Label', axislabelclr => 'black', pie_height => 36, ); open (PNG, ">essai.png"); binmode PNG; #only for Windows like platforms print PNG $my_graph->plot(\@data)->png; close PNG; my $map = new GD::Graph::Map($my_graph,hrefs => \@hrefs); my $HTML_Map_tests = $map->imagemap("essai.png", \@data); my $html; $html = "<html>\n"; $html .= "<head>\n"; $html .= " <title>essai</title>\n"; $html .= " <meta http-equiv=\"content-type\"\n"; $html .= " content=\"text/html; charset=ISO-8859-1\">\n"; $html .= "</head>\n"; $html .= "<BODY bgcolor = \"#ffffff\">\n"; $html .= "$HTML_Map_tests "; $html .= "</body></html>"; open (FILE,">essai.html"); print FILE $html; print " ...File essai.html has been generated\n"; close (FILE);
    Use of uninitialized value in numeric lt (<) at /usr/local/lib/perl5/s +ite_perl/5.6.1/GD/Graph/Map.pm line 367. Use of uninitialized value in numeric lt (<) at /usr/local/lib/perl5/s +ite_perl/5.6.1/GD/Graph/Map.pm line 361. Use of uninitialized value in numeric gt (>) at /usr/local/lib/perl5/s +ite_perl/5.6.1/GD/Graph/Map.pm line 310. Use of uninitialized value in numeric gt (>) at /usr/local/lib/perl5/s +ite_perl/5.6.1/GD/Graph/Map.pm line 311. Use of uninitialized value in numeric gt (>) at /usr/local/lib/perl5/s +ite_perl/5.6.1/GD/Graph/Map.pm line 366. Use of uninitialized value in numeric lt (<) at /usr/local/lib/perl5/s +ite_perl/5.6.1/GD/Graph/Map.pm line 367. Use of uninitialized value in numeric lt (<) at /usr/local/lib/perl5/s +ite_perl/5.6.1/GD/Graph/Map.pm line 361. Use of uninitialized value in numeric eq (==) at /usr/local/lib/perl5/ +site_perl/5.6.1/GD/Graph/Map.pm line 309. Use of uninitialized value in numeric eq (==) at /usr/local/lib/perl5/ +site_perl/5.6.1/GD/Graph/Map.pm line 309. Use of uninitialized value in numeric eq (==) at /usr/local/lib/perl5/ +site_perl/5.6.1/GD/Graph/Map.pm line 309. Use of uninitialized value in numeric eq (==) at /usr/local/lib/perl5/ +site_perl/5.6.1/GD/Graph/Map.pm line 309. Use of uninitialized value in numeric eq (==) at /usr/local/lib/perl5/ +site_perl/5.6.1/GD/Graph/Map.pm line 309. Use of uninitialized value in numeric eq (==) at /usr/local/lib/perl5/ +site_perl/5.6.1/GD/Graph/Map.pm line 309. Use of uninitialized value in numeric eq (==) at /usr/local/lib/perl5/ +site_perl/5.6.1/GD/Graph/Map.pm line 309. ...File essai.html has been generated
    How can i do?
      The documentation for GD::Graph::MAP specificaly states that @hrefs array must have the same size (i.e. same number of elements) as the nuber of legends. You have 6 legends but only four elements of hrefs.