Page 1 of 1

Need Help with grids

Posted: Wed Jun 18, 2008 10:34 am
by Joez
How do I display a curve in a grid and extract data from it for a PHP based web application?
I need to extract data such as the number of boxes in the grid that contains part of the curve.
Is JPGraph appropriate? If not, what should i use??
Please help!!

Re: Need Help with grids!! URGENT!!

Posted: Wed Jun 18, 2008 10:49 am
by onion2k
JPGraph would help you display a graph if that's what your curve is, but it won't help you analyse anything about the graph such as the number of grid squares the curve goes through. For that you'd need to write some custom GD code that analysed the output from JPGraph.

Best of luck if this really is urgent because that'd going to be very time consuming...

Re: Need Help with grids!! URGENT!!

Posted: Wed Jun 18, 2008 11:01 am
by Joez
Other than JPGraph, is there any thing else that can be of help?

Re: Need Help with grids!! URGENT!!

Posted: Wed Jun 18, 2008 11:06 am
by onion2k
Any graphing class would help draw the graph (assuming it is a graph you want..). Besides that, there's not really anything that would apply by the sounds of it. You'll need to code it yourself.

Re: Need Help with grids!! URGENT!!

Posted: Wed Jun 18, 2008 11:18 am
by Joez
It is a grid that I need where i have to plot the curve or line. Then i have to extract the data such as the number of boxes in the grid that contains part of the curve or line.

Re: Need Help with grids

Posted: Wed Jun 18, 2008 11:30 am
by onion2k
So it's not a graph then. In that case JPGraph won't help, not will any other graphing application. You're going to have to write a lot of code yourself.

If you need to draw a curve I wrote some bezier curve code once that might help... It's part of this script: http://www.phpgd.com/scripts.php?script=37 .. shouldn't be too hard to rip out the curve stuff.

As for calculating which grid elements have a bit of the curve in them, I think you might actually be better off going that mathematically rather than visually with GD. Depends hpw good your maths is really.