Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: GD Graph

by tomhukins (Curate)
on Sep 28, 2005 at 12:42 UTC ( #495716=note: print w/replies, xml ) Need Help??

in reply to GD Graph

You say that your script fails, but not how it fails. Do you see error messages? Does it not do what you want? If so, what does it do and what do you want it to do?

Essentially, you're tackling two problems: pulling data from a database and building a chart. Try isolating the code to perform each problem separately.

Firstly, query the database and check you have the data structures you expect in $projectname, @dat and $pno using Data::Dumper and warn in your foreach loop.

Secondly pass data of the form you expect to retrieve from the database to GD::Graph::bars and see what happens.

Replies are listed 'Best First'.
Re^2: GD Graph
by bar10der (Beadle) on Sep 28, 2005 at 12:58 UTC
    I did run the data extraction code and it returns the expected values from the database. No problem there.

    When I print value of $projectname variable I get following (as expected)-

    'RMG Escalation Management Tool','Dynamic Reconfiguration FY06 Initiative'

    If I put this line -

    $mygraph->set_legend('Dynamic reconfiguration FY06 Initiative','Rmg Escalation Management Tool');

    The graph is generated.

    However if I put this-


    I get following err in server log

    Wed Sep 28 13:49:24 2005 error client x.x.x Wed Sep 28 13:49:24 2005 Illegal division by zero at ....GD/Graph/ line 1962., referer: http://index1.html

      $projectname needs to be an ARRAY:

      Methods $graph->set_legend(@legend_keys); Sets the keys for the legend. The elements of @legend_keys corresp +ond to the data sets as provided to plot(). If a key is undef or an empty string, the legend entry will be ski +pped.

      my @projectname = ('Dynamic reconfiguration FY06 Initiative','Rmg Escalation Management Tool');




      Walking the road to enlightenment... I found a penguin and a camel on the way.....
      Fancy a Just ask!!!

        Thanks for your help. It worked!!

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://495716]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2021-10-16 02:44 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (69 votes). Check out past polls.