Compucolor.org – Virtual Media

Listing of file='GRAPH.BAS;01' on disk='vmedia/statistics_1-sector.ccvf'

5 REM  GRAPH
7 REM  WRITTEN BY WALTER DEGLER  2/25/79
9 REM
10 REM  HISTOGRAMS AND POLYGONAL GRAPHS ARE DRAWN
25 PLOT 27,24,14,12,6,2
30 DEF FN X(Z)= 22+ 99* (Z- X(0)+ W(0))/ (X(C- 1)+ W(C- 1)- X(0)+ W(0))
32 DEF FN Y(Z)= 21+ 8* FY* (Z- YS)/ YI
35 DIM X(149),F(149)
36 DIM W(149)
50 GOSUB 2000:REM  INPUT DATA
60 FOR I= 0TO C- 1:W(I)= W(I)/ 2:NEXT
75 GOTO 5000
1999 REM
2000 REM  INPUT DATA
2025 INPUT "IS DATA ALREADY GROUPED? ";Z$:Z$= LEFT$ (Z$,1)
2030 PRINT
2035 PLOT 6,1
2050 IF Z$< > "Y"AND Z$< > "N"THEN 2025
2075 IF Z$= "N"THEN 3200
2100 INPUT "DATA SOURCE (F-FILE OR K-KEYBOARD): ";Z$
2110 PRINT
2125 IF Z$< > "F"AND Z$< > "K"THEN 2100
2150 IF Z$= "K"THEN 2650
2160 PLOT 6,1
2175 INPUT "FILE NAME, DATA TYPE #, FREQUENCY TYPE #: ";F$,T1,T2
2180 PLOT 6,2
2185 PRINT
2200 FILE "R",1,F$,4
2225 GET 1,T1,5;C
2230 IF C> 8THEN C= 8
2250 FOR I= 0TO C- 1
2275 GET 1,T1,9+ 4* I;X(I)
2280 IF I= 0THEN MN= X(0):MX= X(0)
2285 IF MN> X(I)THEN MN= X(I)
2290 IF MX< X(I)THEN MX= X(I)
2300 GET 1,T2,9+ 4* I;F(I)
2325 NEXT
2375 INPUT "ARE WIDTHS CONSTANT? ";Z$:Z$= LEFT$ (Z$,1)
2400 IF Z$< > "Y"AND Z$< > "N"THEN 2375
2425 IF Z$= "Y"THEN FILE "C",1:GOTO 3050
2450 INPUT "WIDTH TYPE # (OR '5' IF NOT IN FILE): ";T3
2500 IF T3= 5THEN FILE "C",1:GOTO 2925
2525 FOR I= 0TO C- 1
2550 GET 1,T3,9+ 4* I;W(I)
2575 NEXT
2580 FILE "C",1
2625 RETURN
2650 INPUT "NUMBER OF CLASSES? ";C
2660 PLOT 12,15,6,1
2675 PRINT "ENTER CLASS NUMBER, CLASS MARK AND FREQUENCY:"
2680 PLOT 27,11,6,3
2700 INPUT "#";I
2710 IF I< 1THEN PLOT 27,24,12,14,6,2:GOTO 2850
2725 PRINT SPC( 6);:PLOT 28
2750 INPUT "";X(I- 1)
2755 IF I= 1THEN MN= X(0):MX= X(0)
2760 IF MN> X(I- 1)THEN MN= X(I- 1)
2765 IF MX< X(I- 1)THEN MX= X(I- 1)
2775 PRINT SPC( 14);:PLOT 28
2800 INPUT "";F(I- 1)
2825 GOTO 2700
2850 INPUT "ARE CLASS WIDTHS CONSTANT? ";Z$:Z$= LEFT$ (Z$,1)
2875 IF Z$< > "Y"AND Z$< > "N"THEN 2850
2900 IF Z$= "Y"THEN 3050
2925 PRINT "ENTER CLASS WIDTHS (LOW CLASS TO HIGH):"
2950 FOR I= 0TO C- 1
2975 PRINT "#";I+ 1;:INPUT "  ";W(I)
3000 NEXT
3025 RETURN
3050 W= (MX- MN)/ (C- 1)
3075 FOR I= 0TO C- 1
3100 W(I)= W
3125 NEXT
3150 RETURN
3200 INPUT "NUMBER OF CLASSES AND LOWEST CLASS MARK: ";C,X(0)
3225 INPUT "CLASS WIDTH (OR '0' IF NOT CONSTANT): ";W
3250 IF W> 0THEN 3970
3275 PRINT "ENTER CLASS WIDTHS (LOW CLASS TO HIGH):"
3300 FOR I= 0TO C- 1
3325 PRINT "#";I+ 1;:INPUT "  ";W(I)
3350 NEXT
3375 FOR I= 1TO C- 1
3400 X(I)= X(I- 1)+ .5* (W(I- 1)+ W(I))
3425 NEXT
3450 INPUT "FILE SOURCE (F-FILE OR K-KEYBOARD): ";Z$
3475 IF Z$< > "F"AND Z$< > "K"THEN 3450
3500 IF Z$= "F"THEN 3650
3510 PLOT 6,6
3525 INPUT "NUMBER OF VALUES: ";NO
3530 PLOT 12,15,6,1
3550 PRINT :PRINT "VALUE NUMBER AND VALUE:"
3560 PLOT 6,3
3575 INPUT "#";I
3580 IF I< 1THEN PLOT 12,14,6,2:RETURN
3600 PRINT SPC( 6);:PLOT 28:INPUT D
3625 GOSUB 3900
3630 GOTO 3575
3650 INPUT "FILE NAME AND DATA TYPE NUMBER: ";F$,T1
3675 FILE "R",1,F$,4
3700 GET 1,T1,5;NO
3725 FOR I= 0TO NO- 1
3750 GET 1,T1,9+ 4* I;D
3775 GOSUB 3900
3800 NEXT
3825 RETURN
3900 IF D< X(0)- W(0)/ 2THEN RETURN
3920 FOR J= 0TO C- 1
3940 IF D< X(J)+ W(J)/ 2THEN F(J)= F(J)+ 1:RETURN
3960 NEXT
3965 RETURN
3970 FOR I= 0TO C- 1
3975 W(I)= W
3980 NEXT
3985 GOTO 3375
3999 REM
4000 REM  DRAW COORDINATE SYSTEM WITH SCALES
4005 INPUT "NAME OF GRAPH: ";G$
4010 INPUT "NAME OF X-SCALE, Y-SCALE: ";X$,Y$
4012 PLOT 12,15,6,3
4015 PLOT 3,(64- LEN (G$))/ 2,0:PRINT G$
4017 PLOT 27,10,3,0,(32- LEN (Y$))/ 2:PRINT Y$
4020 PLOT 27,24,3,(72- LEN (X$))/ 2,30:PRINT X$
4022 PLOT 6,2
4025 PLOT 2,21,19,242
4050 PLOT 122,19,122,120,21,120,21,19
4075 PLOT 255
4100 FOR I= 0TO C- 1
4110 PLOT 2,FN X(X(I)),18,255
4125 PLOT 3,FN X(X(I))/ 2- 2,28:PRINT X(I)
4150 NEXT
4155 LY= LEN (STR$ (YS))
4160 FOR I= YS+ YITO YESTEP YI
4165 X= LEN (STR$ (I))
4167 IF X> LYTHEN LY= X
4169 NEXT
4170 LY= 9- LY
4172 X= (YE- YS)/ YI:IF X> 12THEN X= 12:YE= YS+ 12* YI
4175 FOR I= 0TO X
4180 PLOT 2,20,21+ 8* I,255
4200 PLOT 3,LY,26- 2* I:PRINT YS+ I* YI
4225 NEXT
4250 GOTO 6000
4999 REM
5000 REM  INPUT FREQUENCY PARAMETERS
5025 INPUT "Y-SCALE BEGINNING, END, DIFFERENCE: ";YS,YE,YI
5030 PLOT 6,6
5040 PRINT
5050 INPUT "HEIGHT FACTOR: ";FY
5052 PLOT 12,6,3
5055 PRINT "ENTER NUMBER OF CHOICE:"
5057 PRINT "1 - SOLID RECTANGLES":PRINT "2 - HOLLOW RECTANGLES"
5060 PRINT "3 - HOLLOW RECTANGLES WITH POLYGON"
5062 PRINT "4 - POLYGON ONLY"
5065 INPUT FT:FT= INT (FT)
5067 PRINT
5069 PLOT 6,2
5070 IF FT< 1OR FT> 4THEN 5065
5075 IF Z$= "X"THEN 4012
5100 GOTO 4000
5999 REM
6000 REM  DRAW RECTANGLES
6005 PLOT 6,1
6010 IF FT= 4THEN 7000
6025 FOR I= 0TO C- 1
6050 X= FN X(X(I)- W(I)):Y= FN X(X(I)+ W(I))
6060 Z= FN Y(F(I)/ (2* W(I)))
6065 IF Z> 119THEN Z= 119
6067 IF Z< 20THEN 6150
6070 IF FT= 1THEN 6210
6075 PLOT 2,X,20,242
6100 PLOT Y,20,Y,Z,X,Z,X,20
6125 PLOT 255
6150 NEXT
6175 IF FT= 3THEN 7000
6180 PLOT 6,2
6200 GOTO 6275
6210 FOR J= 20TO Z
6225 PLOT 2,X,J,242,Y,J,255
6250 NEXT J,I
6275 PLOT 6,1,3,0,31
6300 INPUT "ENTER 1-NEW SCALES, 2-SAVE OR 3-END: ";X
6310 PLOT 12
6325 IF X= 1THEN Z$= "X":GOTO 5000
6350 IF X< > 2THEN LOAD "MENU":RUN
6375 PLOT 27,4:PRINT "SAVE GRAPH.DSP 6000 1000":PLOT 27,27
6400 PLOT 12
6425 INPUT "ENTER 1-NEW SCALES OR 2-END: ";X
6430 PLOT 12
6450 IF X= 1THEN Z$= "X":GOTO 5000
6475 LOAD "MENU":RUN
6999 REM
7000 REM  DRAW POLYGON
7010 PLOT 6,6
7025 PLOT 2,22,20,242
7050 FOR I= 0TO C- 1
7075 Z= FN Y(F(I)/ (2* W(I)))
7100 IF Z> 119THEN Z= 119
7125 IF Z< 20THEN Z= 20
7150 PLOT FN X(X(I)),Z
7175 NEXT
7200 PLOT 121,20,255
7225 PLOT 6,2
7250 GOTO 6275