Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Flat File Database & GD::Graph (REVISITED)

by tradez (Pilgrim)
on Mar 18, 2002 at 18:27 UTC ( #152546=note: print w/ replies, xml ) Need Help??


in reply to Flat File Database & GD::Graph (REVISITED)

A Good practice I have found while working with GD Graphs is that when setting a max value for the y-axis, do it with a little more intuitiveness. Useually when building you @yAxis structures, you do it in a loop, like you are. Try adding a little flare. Also While looking at this I am seeing a discrepency in your logic, if I see this correctly you will not be getting the output I suspect you want. With this you will get a graph with just one point. I would expect you when a linespoints graph with all of the data from the flat file plotted. maybe something like this.

my $largestValue = 0; my (@xAxisOfDates,@yAxisOfPartners,@yAxisOfArfi, @data) = (); open(HANDLE,"integrate.dat"); while (<HANDLE>) { chomp; @temp1 = split(/\|/, $_); $domain = unpack ("A5", $temp1[17]); push(@xAxisOfDates, $temp1[1]); push(@yAxisOfPartners, $temp1[4]); push(@yAxisOfArf, $temp1[5]); if ($temp1[4] > $largestValue){ $largetValue = $temp1[4]; } if ($temp1[5] > $largestValue){ $largestValue = $temp1[5]; } } close(HANDLE); @data = (\@xAxisOfDates, \@yAxisOfPartners, \@yAxisOfArf);
and then this in your setup of graph parameters set your y_max_value => $largestValue
Hopefully this helps and I was able to see why you were not getting what you expected with output, if I was offtarget, /tell me in the talk window and I will help, I am pretty knowledgable when it comes to GD applications.

Tradez
"Never underestimate the predicability of stupidity"
- Bullet Tooth Tony, Snatch (2001)


Comment on Re: Flat File Database & GD::Graph (REVISITED)
Download Code
Replies are listed 'Best First'.
Re: Re: Flat File Database & GD::Graph (REVISITED)
by suggus (Sexton) on Mar 18, 2002 at 20:28 UTC
    Tradez,

    Has this code been tested? I tried it, but still got a 500 error still. I found only 1 typo where it says:
    my (@xAxisOfDates,@yAxisOfPartners,@yAxisOfArfi, @data) = ();

    Where you had an extra 'i' at the end of the array. It should have been:
    my (@xAxisOfDates,@yAxisOfPartners,@yAxisOfArf, @data) = ();

    I suspect that the array is not spacing out the values and GD::Graph module does not like that formatting. Is there another way to do this?
    ---------------------
    I'm always learning.
    zen-designs.com

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (10)
As of 2015-07-30 08:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (270 votes), past polls