Qbasicnews.com

Full Version: Cartesian graphing
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I was just curious tonight, and I made a graphing program.
The problem I'm having is setting customizable window settings.
Will you guys help me implement that? Here's the code.
Code:
DEFDBL A-Z
SCREEN 13

xhalf = 160
yhalf = 100
xfull = 320
yfull = 200

'not fully implemented, but meh

xmin = -10
xmax = 10
ymin = -10
ymax = 10

xrange = xmax - xmin
yrange = ymax - ymin

xchange = xmax / xhalf
          
LINE (xhalf - 1, 0)-(xhalf - 1, yfull - 1), 15
LINE (0, yhalf - 1)-(xfull - 1, yhalf - 1), 15

  b = xmin
  FOR x = 0 TO xfull-1
    y = mx + b
  
    newy = -(y / xchange) + yhalf
    b = b + xchange
    IF oldx THEN LINE (oldx, oldy)-(x, newy), 15 ELSE PSET (x, newy), 15
    oldy = newy: oldx = x
  NEXT
http://www.geocities.com/gstumpff/graph.zip

is my version of a graphing program, if that helps.
It's too freakin huge! I'm trying to make this a simple little program.
and still customizable in some way? Okaaaaaaay. Smile
heres a graphing program thats not mine
http://qb45.tonez-online.com/qbasic/pn/u...p?base=yes
that should do it.
then goto the file menu on the side and go in the misc category
and go to page nine. if that don't work then'll i'll send it to you in an email
Is there any way for you guys to just change my source up? These programs are way to big to follow...

Basically I just want to be able to set the window... that's all.
I might do that. However, I will suggest that you use mode 12. Plots of data are generally more useful with smaller pixels and as many pixels per screen width/height as you can get. (If you're worried about mode 13 being faster than 12, 12 isn't that slow, especially for this kind of thing, and speed isn't usually that important for this. The point of plotting data is to generate the plot so you can figure something out, demonstrate a point to someone, etc., not watch stuff occur on the screen fast. Smile )
I made it for 12, but I was flipping back and forth between the IDE and the program, so I was getting annoyed at the long time to switch to screen 12.
. (And actually, I did think I saw a "639" in your code at one point, but then I saw the "SCREEN 13".)
Oh ya, I better fix that.