10 REM HORIZONTAL BAR CHART; John W. Coviello; 9 August 1982
20 DEFINT A-V:E$=CHR$(27):K$=E$+"K":G$=E$+"G":F$=E$+"F":WIDTH LPRINT 255
30 DEFDBL Z:Y$=E$+"Y":P$=E$+"p":Q$=E$+"q"
40 PRINT E$;"x5";E$;"E";F$;P$
50 PRINT Y$;"!,";STRING$(56,"w")
60 FOR I=34 TO 48:PRINT Y$;CHR$(I);",ww":NEXT I
70 PRINT Y$;"1,";STRING$(56,"w")
80 FOR I=34 TO 48:PRINT Y$;CHR$(I);"bww":NEXT I
90 PRINT G$;Q$;Y$;"#BHORIZONTAL";Y$;"%CBAR CHART";Y$;"(Gby"
100 PRINT Y$;"*@John W. Coviello";Y$;",AAugust 24, 1982"
110 PRINT Y$;"/>All Rights Reserved"
120 PRINT Y$;"39SETTING GRAPHIC CHARACTER CODES":GOSUB 1060
130 PRINT Y$;"37Would You Like Instructions? (y/n)"
140 X$=INPUT$(1):IF X$="Y" OR X$="y" THEN GOSUB 1560
150 PRINT E$;"E";E$;"y5";:INPUT "Number of Variables";V
160 IF V>5 THEN PRINT "Too Many Variables. Enter Again.":GOTO 150
170 PRINT:INPUT "Starting Vertical Entry";V1
180 PRINT:INPUT "Ending Vertical Entry";V3
190 PRINT:INPUT "Vertical Increment";V2
191 LET X=V*((V3-V1)/V2+1)*5/24:LET Y=X*5/3
192 PRINT:PRINT "Height of Chart Will be:"
193 PRINT "   ";X;"Inches for Single Height Bars"
194 PRINT "   ";Y;"Inches for Double Height Bars"
195 PRINT:INPUT "Select Single or Double Height Bars (1/2)";DB
200 PRINT:INPUT "Enter Label for Vertical";V$
210 IF (V3-V1)MOD V2=0 GOTO 230
220 PRINT:PRINT "Scale and Increment do not agree. Enter Again.":GOTO 170
230 LET L=(V3-V1)\V2:IF V*(L+1)>50 THEN GOTO 160
240 DIM N(V-1,L):DIM S(V-1):DIM L$(L):DIM A$(V-1)
250 FOR I=0 TO L:LET J=V1+I*V2:LET L$(I)=STR$(J):NEXT I
260 PRINT E$;"E":INPUT "Minimum Horizontal Dimension";H1
270 PRINT:INPUT "Maximum Horizontal Dimension";H3
280 IF H3>H1 GOTO 290 ELSE PRINT "Maximum Must be Greater Than Minimum.":GOTO 260
290 PRINT:INPUT "Horizontal Increment";H2
300 PRINT:INPUT "Horizontal Width (Inches, 2 to 6)";W
310 IF NOT (H3-H1)MOD H2=0 THEN PRINT "Dimension Wrong. Enter Again.":GOTO 260
320 IF (H3-H1)\H2>2*W THEN PRINT "Increment Too Small. Enter Another.":GOTO 290
330 PRINT:INPUT "Enter Label for Horizontal";H$
340 LET W=60*W:LET H=H3-H1:PRINT E$;"E";E$;"F"
350 FOR I=0 TO 5:PRINT E$;"Y";CHR$(32);CHR$(32+10*I);I;STRING$(5,CHR$(C(I))):NEXT I
360 FOR I=0 TO 5:PRINT E$;"Y";CHR$(34);CHR$(32+10*I);I+6;STRING$(5,CHR$(C(I+6))): NEXT I
370 FOR I=O TO 5:PRINT E$;"Y$";CHR$(32+10*I);I+12;P$;STRING$(5,CHR$(C(I)));Q$:NEXT I
380 FOR I=0 TO 5:PRINT E$;"Y&";CHR$(32+10*I);I+18;P$;STRING$(5,CHR$(C(I+6)));Q$:NEXT I
390 PRINT E$;"G";E$;"Y( ";
400 FOR I=0 TO V-1:PRINT "Enter Code for Variable ";CHR$(I+65):INPUT S(I):NEXT I
410 PRINT "Enter Label for Variable (Up to 10 Characters)."
420 FOR I=0 TO V-1:PRINT "  Variable ";CHR$(I+65);:INPUT A$(I):NEXT I
430 PRINT:PRINT "Enter Caption For Chart.":INPUT C$
440 PRINT:PRINT "Tabular Manual Input or SuperCalc Input? (T/S)"
450 X$=INPUT$(1):IF X$="S" OR X$="s" GOTO 1750
460 PRINT E$;"E"
470 FOR I=0 TO V-1:PRINT "VARIABLE ";CHR$(I+65);", FOR Y="
480 FOR J=0 TO L
490 PRINT V1+V2*J;"; ";CHR$(I+65);"=";:INPUT; Z
500 IF Z>=H1 AND Z<=H3 GOTO 520
510 PRINT:PRINT "Outside Chart Area. Enter Again.":GOTO 490
520 LET Z=(Z-H1)/H:LET Z=INT(Z*W):LET N(I,J)=Z:PRINT ,:NEXT J:PRINT:NEXT I
530 PRINT:PRINT "Do You Want to Preview Chart? (y/n)"
540 X$=INPUT$(1):IF X$="Y" OR X$="y" THEN GOTO 1250
550 PRINT E$;"x1";P$;Y$;"8 PRINTING NOW, MAKE SURE PRINTER IS ON.       ";Q$
560 LPRINT E$;CHR$(51);CHR$(15):LET N=0
570 FOR K=0 TO 8 STEP 8:LPRINT TAB(10);:FOR Q=1 TO 3:LET S=S(N)
580 LPRINT K$;CHR$(40);CHR$(0);
590 FOR I=0 TO 4:FOR J=K TO K+7:LPRINT CHR$(A(S,J));:NEXT J:NEXT I
600 IF K=0 THEN LPRINT STRING$(13," ");
610 LET X=12-LEN(A$(N))
620 IF K=8 THEN LPRINT " ";A$(N);STRING$(X," ");
630 LET N=N+1
640 IF N<>V GOTO 670
650 IF K=8 GOTO 690
660 LET N=N-Q:GOTO 680
670 NEXT Q:IF K=0 THEN LET N=N-3
680 NEXT K:GOTO 570
690 LPRINT:LPRINT E$;CHR$(51);CHR$(27)
700 LPRINT E$;CHR$(69);E$;CHR$(83);V$;E$;CHR$(70)
710 LPRINT E$;CHR$(51);CHR$(15)
720 FOR Q=0 TO L:FOR R=0 TO V-1:LET X=N(R,Q):LET S=S(R)
730 GOSUB 910:NEXT R:NEXT Q
740 LET D=INT(W*H2/H):LET X=D*H/H2+3:LET D=D-3
750 LPRINT E$;CHR$(51);CHR$(6)
760 LPRINT STRING$(8," ");
770 LET N1=X MOD 256:LET N2=X\256:LPRINT K$;CHR$(N1);CHR$(N2);
780 FOR I=1 TO H\H2:LPRINT STRING$(3,127);STRING$(D,96);:NEXT I
790 LPRINT STRING$(3,127);
800 LPRINT E$;"@"
810 LET T=(H3-H1)/H2:LET T=W/T
820 FOR I=0 TO (H3-H1)/H2:LPRINT TAB(INT(T*I/6+7));H1+H2*I;:NEXT I
830 LPRINT:LPRINT TAB(8+W\12-LEN(H$));
840 LPRINT E$;CHR$(69);E$;CHR$(83);H$
850 LPRINT:LPRINT C$
860 LPRINT E$;"@"
870 PRINT STRING$(70," ")
880 PRINT "Do You Want to Make Another Chart? (y/n)"
890 X$=INPUT$(1):PRINT E$;"z"
900 IF X$="Y" OR X$="y" THEN CLEAR:GOTO 10 ELSE END
910 LET N1=X MOD 256:LET N2=X\256
920 LET N4=N1 MOD 8:LET N1=N1-N4
925 FOR M=1 TO DB
930 FOR K=0 TO 8 STEP 8
940 LET L1=LEN(L$(Q))
950 IF K=8 AND R=V\2 AND M=DB THEN LPRINT STRING$(6-L1," ");L$(Q);" ";:GOTO 970
960 LPRINT STRING$(7," ");
970 LPRINT K$;CHR$(6);CHR$(0);STRING$(4,0);CHR$(31);CHR$(31);
980 LPRINT K$;CHR$(N1+N4);CHR$(N2);
990 FOR I=1 TO (N1/8+32*N2):FOR J=K TO K+7
1000 LPRINT CHR$(A(S,J));:NEXT J:NEXT I:IF N4=0 GOTO 1020
1010 FOR J=K TO K+N4-1:LPRINT CHR$(A(S,J));:NEXT J
1020 LPRINT:NEXT K:NEXT M:LPRINT STRING$(7,32);K$;CHR$(6);CHR$(0);
1030 IF R<>V-1 THEN LPRINT STRING$(4,0);CHR$(31);CHR$(31)
1040 IF R=V-1 THEN LPRINT STRING$(4,14);CHR$(31);CHR$(31)
1050 RETURN
1060 DIM A(23,15):REM GRAPHIC CHARACTER CODES
1070 FOR I=0 TO 11
1080 FOR J=0 TO 15
1090 READ A(I,J):NEXT J:NEXT I
1100 RESTORE
1110 FOR I=12 TO 23
1120 FOR J=0 TO 15
1130 READ A:LET A(I,J)=31-A:NEXT J:NEXT I
1140 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,7,3,0,0,0,16,24,24,24,16,0,16
1150 DATA 24,28,30,31,31,31,31,0,0,0,16,24,28,31,31,0,0,0,31,31,0,0,0,0,0,0,31,31
1160 DATA 0,0,0,1,1,1,31,31,1,1,1,16,16,16,31,31,16,16,16,0,0,1,1,5,3,1,0,0,0,0,0
1170 DATA 8,16,0,0,21,10,21,10,21,10,21,10,10,21,10,21,10,21,10,21,0,0,0,0,31,31
1180 DATA 31,31,0,0,0,0,31,31,31,31,31,31,31,31,30,28,24,16,31,28,24,16,0,0,0,0
1190 DATA 24,12,6,3,3,6,12,24,3,6,12,24,24,12,6,3,0,0,0,1,3,6,12,24,3,6,12,24
1200 DATA 16,0,0,0,24,12,6,3,1,0,0,0,0,0,0,16,24,12,6,3
1210 DIM C(11)
1220 FOR I=0 TO 11:READ C(I):NEXT I
1230 DATA 32,94,95,96,98,104,105,113,114,119,120,121
1240 RETURN
1250 REM GRAPH PREVIEW
1260 PRINT E$;"E";E$;"x5"
1270 LET I=0
1280 FOR J=1 TO 3:LET S=S(I):IF S>11 THEN LET P=1 ELSE LET P=0
1290 IF S>11 THEN LET S=S-12
1300 PRINT TAB(20*J-10);F$;
1310 IF P=1 THEN PRINT P$;
1320 PRINT STRING$(5,CHR$(C(S)));G$;
1330 IF P=1 THEN PRINT Q$;
1340 PRINT " ";A$(I);
1350 LET I=I+1:IF I=V GOTO 1370
1360 NEXT J:PRINT
1370 PRINT:PRINT
1380 PRINT V$:PRINT F$;
1390 FOR I=0 TO L:FOR J=0 TO V-1
1400 LET X=N(J,I):LET X=X\6:LET S=S(J)
1410 IF S>11 THEN LET P=1 ELSE LET P=0
1420 IF S>11 THEN LET S=S-12
1430 LET L1=LEN(L$(I))
1440 IF J=V\2 THEN PRINT STRING$(6-L1," ");L$(I);" ";
1450 IF J<>V\2 THEN PRINT STRING$(7," ");
1460 IF S>11 THEN LET S=S-12
1470 IF P=1 THEN PRINT P$;
1480 PRINT STRING$(X,C(S));:IF P=1 THEN PRINT Q$;
1490 PRINT:NEXT J:NEXT I:PRINT
1500 LET Z=(H3-H1)/H2:LET Z=W/Z
1510 FOR I=0 TO (H3-H1)/H2:PRINT TAB(INT(Z*I/6+6));H1+H2*I;:NEXT I:PRINT
1520 PRINT G$:PRINT TAB(8+W/12-LEN(H$)/2);H$
1530 PRINT:PRINT C$
1540 PRINT E$;"y5";G$;"Press RETURN to Print Chart or 'R' to Redo"
1550 X$=INPUT$(1):IF X$="R" OR X$="r" THEN CLEAR:GOTO 10 ELSE GOTO 550
1560 REM INSTRUCTIONS
1570 PRINT E$;"E"
1580 PRINT "This Program Develops a Bar Chart with Horizontal Bars Representing"
1590 PRINT "  up to 5 Variables.  The Width of the Chart Can be Between 1 and 5"
1600 PRINT "  Inches and is Independent of the Horizontal Scale.":PRINT
1610 PRINT "The Vertical Scale of the Chart Can Use Numbers of up to 5 digits,"
1620 PRINT "  but There Must be an Integral Relationship Between the Starting"
1630 PRINT "  Entry, the Ending Entry, and the Increment.":PRINT
1640 PRINT "The Limitations on the Horizontal Scale are the Same as the Verti-"
1650 PRINT "  cal Scale and in Addition, There Must be Enough Room to Print the"
1660 PRINT "  Number of Increments Calculated":PRINT
1670 PRINT "To Input Values from SuperCalc, Strip the Borders (Use SC; /G,B) "
1680 PRINT "  then Output Only the Values to a Print (????.PRN) File."
1690 PRINT:PRINT "To Exit the Program at any Time, Type a CTRL C.":PRINT
1700 PRINT P$;"NOTE:";Q$;"  THE PROGRAM WILL HALT IF THE PRINTER IS NOT ON."
1710 PRINT:PRINT "CTRL 'P' and CTRL 'Q' can be Used to Stop Display Scrolling"
1720 PRINT "  While Previewing the Chart.
1730 PRINT:PRINT "Type any Key to Return to Program."
1740 X$=INPUT$(1):RETURN
1750 REM SUPERCALC INPUT FOR VARIABLES
1760 PRINT:PRINT "Enter Filename for SuperCalc File (?:????.PRN)":INPUT X$
1770 OPEN "I",1,X$
1780 PRINT:PRINT "Are Variables Arranged in Rows or Columns? (R/C)"
1790 X$=INPUT$(1)
1800 IF X$="C" OR X$="c" THEN LET I1=L:LET K1=V ELSE LET I1=V-1:LET K1=L+1
1820 FOR I=0 TO I1
1830 LET J=0:LET K=0:LET SC$="":INPUT #1,X$
1840 LET J=J+1:LET X1$=MID$(X$,J,1)
1850 IF X1$=" " GOTO 1840 ELSE LET SC$=SC$+X1$
1860 LET X1$=MID$(X$,J+1,1):IF X1$>"'" AND X1$<":" GOTO 1840
1870 LET Z=VAL(SC$):LET Z=(Z-H1)*W\H
1875 IF K1=V THEN LET N(K,I)=Z ELSE LET N(I,K)=Z
1880 LET K=K+1:LET SC$="":IF K<>K1 GOTO 1840
1890 NEXT I:CLOSE #1:GOTO 530
1875 IF K1=V THEN LET N(K,I)=Z ELSE LET N(I,K)=Z
1880 LET K