Qbasicnews.com
September 30, 2020, 08:18:06 PM
 Pages: [1]
 Author Topic: Plotting point graphing  (Read 5420 times)
bubblesdee
New Member

Posts: 3

 « on: February 13, 2007, 10:42:41 PM »

Hi

Just looking for some help on graphing some temperature data in "real" time.

I have a program that reads temperature at 1 minute intervals.  I would like to plot the points (maybe PSET) as the rest of the program is running.

How do I define where the points will be plotted? I have other things going on in the program like radio buttons that control pumps and solenoids.

I am using Quickbasic for MAC

 Logged
Ralph
Ancient Guru

Posts: 544

 « Reply #1 on: February 14, 2007, 12:35:43 AM »

Here is a program in QuickBASIC 4.5 that plots some temperature points.  Hopefully, you wll be able to adapt it to your requirements.  Let us know.
Code:
'TEMP, by Ralph A. Esquivel, plots degrees F vs time in seconds

SCREEN 9: Xmax = 640: Ymax = 350

FG = 1 'blue foreground
BG = 7  'white background

COLOR FG, BG
CLS

MULT = 10
FOR I = MULT TO TIME * MULT + MULT STEP MULT
TEMP = Ymax - T
CIRCLE (I, TEMP), 2
PAINT (I, TEMP), 1
SLEEP 1 'wait 1 second to simulate data at rate of 1 per second
NEXT I
PRINT "Press any key to terminate program
SLEEP
END

'Temperature data (first is number of temperature data:
DATA 14, 32, 42, 49, 55, 60, 64, 67, 69, 70, 69, 70, 71, 70, 71, 0
 Logged

Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
Ralph
Ancient Guru

Posts: 544

 « Reply #2 on: February 14, 2007, 02:07:42 AM »

Here's that program, somewhat improved:
Code:
'TEMP, by Ralph A. Esquivel, plots degrees F vs time in seconds

SCREEN 9: Xmax = 640: Ymax = 350

FG = 1 'blue foreground
BG = 7 'white background

COLOR FG, BG
CLS

'draw x-axis
X = 40
LINE (X, Ymax - 60)-(Xmax - 10, Ymax - 60)
LOCATE 22, 5
MULT1 = 10
FOR I = MULT1 TO 170 STEP MULT1
PRINT I - MULT1;
IF I = 10 THEN LINE (X + 32, 140)-(X + 32, Ymax - 60)
NEXT I

'draw y-axis
LINE (X, 140)-(X, Ymax - 60)
LOCATE 10
FOR I = 10 TO 0 STEP -1
PRINT I * 10
IF I = 7 THEN LINE (X, Ymax - 60 - 102)-(Xmax - 10, Ymax - 60 - 102)
IF I = 3 THEN LINE (X, Ymax - 60 - 46)-(Xmax - 10, Ymax - 60 - 46)
NEXT I

'plot temperature points
MULT2 = 1.45
FOR I = 1 TO TIME
X0 = I * 3 + 40 - 2
TEMP = Ymax - 60 - T * MULT2
Y0 = TEMP
CIRCLE (X0, Y0), 2
PAINT (X0, Y0), 1
SLEEP 1 'simulate data at rate of 1 per second
NEXT I

LOCATE 10, 10
PRINT "Press any key to terminate program"
SLEEP
END

'Temperature data:
DATA 14, 32, 42, 49, 55, 60, 64, 67, 69, 70, 69, 70, 71, 70, 71, 0
 Logged

Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
bubblesdee
New Member

Posts: 3

 « Reply #3 on: February 14, 2007, 06:55:45 PM »

Thanks

What I am trying to do is graph temperatures that I am reading in from an external temperature sensor. I read the temperature sensor every minute.  While this is going on, I have other parts of the program controlling heaters to either increase or decrease the temperature.

I would like to go to a sub routine that plots the current temperature being read by the sensor.  The variable for temperature is called temp and the variable for time is called time2!.

What I would like would be for the graph to be drawn on the bottom of the screen (below all the othere radio buttons that control heater and pumps).

Would I not have to establish an Intial start point for the graphic curse to go to , to draw the first temperature point and then append this initial start point every time I call the sub, so that the next temperature point is where it should be in relation to time?
 Logged
Ralph
Ancient Guru

Posts: 544

 « Reply #4 on: February 14, 2007, 06:58:42 PM »

I am sending you a PM, as this is too complex for me to carry on here.
 Logged

Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
wallace
Wandering Guru

Posts: 368

 « Reply #5 on: February 15, 2007, 10:51:20 AM »

Where did you get Qbasic for Mac?
 Logged

f you play a Microsoft CD backwards you can hear demonic voices.  The scary part is that if you play it forwards it installs Windows.
 Pages: [1]