Results 1 to 2 of 2

Thread: Line Graph algorithm

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2007
    Posts
    1

    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

  2. #2
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Re: Line Graph algorithm

    Quote 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
  •  



Click Here to Expand Forum to Full Width