|
-
Nov 30th, 2007, 03:56 AM
#1
Thread Starter
New Member
Line Graph algorithm
Hi all,
Does anyone know of any kind of algorithm that generates XY co-ordinates of a graph. I need this algorithm to scale automatically ie any values a user submits the graph must scale according, (ex (12 44,23,) or (3250,1311,5243) .... both values should fit in the graph)
If my post is not understood I'll elaborate on it.
Thanks,
Brad
-
Nov 30th, 2007, 08:56 AM
#2
Re: Line Graph algorithm
 Originally Posted by Brad Davids
Hi all,
Does anyone know of any kind of algorithm that generates XY co-ordinates of a graph. I need this algorithm to scale automatically ie any values a user submits the graph must scale according, (ex (12 44,23,) or (3250,1311,5243) .... both values should fit in the graph)
If my post is not understood I'll elaborate on it.
Thanks,
Brad
Hi, welcome to the forum.
Whenever you add new points to the graph you just check they fall inside the boundaries, i.e. for each new pair (x,y) you check if
xmin <= x <= xmax AND ymin <= y <= ymax
If this is true you plot the point. If not, you assign new values to the boundaries, for example, if ymin> y then redefine ymin = y. Finally you redeine the scale according to the new boundary values and replot all the points.
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|