home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.whtech.com
/
ftp.whtech.com.tar
/
ftp.whtech.com
/
club100
/
bus
/
barch1.ba
< prev
next >
Wrap
Text File
|
2006-10-19
|
3KB
|
79 lines
0 'BARCHT.100 by Tony Anderson Copyright 1985 Tony B. Anderson Version 3.1- Improved screen display
1 'CLUB 100 Library - 415/939-1246 BBS, 937-5039 NEWSLETTER, 932-8856 VOICE
2 '
3 ' This program prints a Bar-Chart comparison for input data, based on a
4 ' percentage of the highest value, or a "real value", assuming all the input
5 ' values are in a range divisible by 10; i.e. 1-100, 10-1000, 100-10000, etc.
6 ' In "percentage" display, the largest value will assume 100% on the chart,
7 ' and other values will be displayed as a percentage of the largest amount.
8 '
10 ' Any number of items may be compared, but only four are displayed on the
11 ' screen at one time due to limited LCD space. On Input, decimal values
12 ' are dropped; only whole numbers are displayed. ( 22.75 = 22 )
13 '
17 ' The 0 to 100 format was chosen because it is difficult to show the
18 ' comparison between large and small values in such limited space. There
19 ' are only about 100 pixels available to make a meaningful display, and
20 ' that number lends itself ideally to displays of percentage. Real value
21 ' inputs are divided by convenient multiples of 10. You can enter a blank
22 ' line for the short name descriptor, and/or a value of 0 where you want
23 ' blank lines in the chart.
24 '
100 ' Initialize
105 MAXFILES=1:CLEAR2500
110 CLS:PRINT@50,"BAR CHART DISPLAY" :PRINT@92,"COPYRIGHT 1985":PRINT
115 LINEINPUT" Name of Chart: ? ";N$
120 INPUT" How many bars in Chart";N
125 N1=(INT(N/4)+1)*4
130 DIM A(N1),B(N1),A$(N1)
140 PRINT" Real Value or Percentage (R/P) ";:INPUTV$
145 V$=LEFT$(V$,1)
150 IFINSTR("RrPp",V$)THEN155ELSEBEEP:GOTO140
155 IFINSTR("Rr",V$)THENF=0ELSEF=1
200 ' Get Input
210 CLS:PRINT@50,"Input Chart Data:
215 FORA=1TON
220 PRINT@80,CHR$(27)"J":PRINT@122,"Data for Item #"A
222 A$(A)=""
225 PRINT@202,"Short Name: __________" :PRINT@214,"? ";:LINEINPUTA$(A)
227 IFA$(A)=""THENA$(A)=" "
230 PRINT@242,"Chart Value: __________" :PRINT@254,"";:INPUTA(A)
235 A(A)=INT(A(A))
240 IFA(A)>LVTHENLV=A(A)
280 NEXT
290 IFFTHEN305
291 T=10
292 IFT>LVTHEN293ELSET=T*10:GOTO292
293 LV=T:T$=STR$(T/100):T$=MID$(T$,2)
300 ' Change to % of Largest Value
305 FORA=1TON
310 B(A)=INT((A(A)/LV)*100)
315 NEXT
400 ' Display Results
405 FORA=1TON1STEP4
410 IFA$(A)=""ANDA(A)=0THEN910
500 ' Draw Screen
505 CLS:PRINT@316,"(c)";:PRINT@0,TAB((40-LEN(N$))/2);N$
510 CALL17001:IFFTHENPRINT" PERCENT: 0% 50 100% VALUE ":GOTO515
512 PRINT" REAL VAL: 0 50 100 AMNT."
515 CALL17006:LINE(68,16)-(68,54)
520 LINE(169,16)-(169,54):LINE(68,54)-(169,54)
525 FORX=78TO158STEP10:FORX1=18TO52STEP2:PSET(X,X1):NEXT:NEXT
526 FORX=73TO163STEP10:PSET(X,19):NEXT
530 IFF=0THENT=(LEN(T$)+5)/2:PRINT@100-T,"REAL*"T$;
600 ' Print Data
605 C=80:FORB=0TO3:C=C+40
610 PRINT@C,A$(B+A);
615 IFA(B+A)<>0THENPRINT@C+29,USING "##########";A(B+A);ELSE720
620 D1=INT(C/40):D1=D1*8+1
700 ' Draw Bars
710 LINE(69,D1+D)-(69+B(B+A)-1,D1+D+5),1,BF
720 NEXTB
800 ' Wait for continue
805 PRINT@280,"Press ENTER to Continue ";:Q$=INPUT$(1):CLS
810 NEXTA
900 ' End Job
910 CLS:PRINT@42,"Job Finished"
920 PRINT@82,"Want to do another chart? ";:Q$=INPUT$(1):PRINTQ$
930 IFQ$="Y"ORQ$="y"THENRUNELSEMENU