home *** CD-ROM | disk | FTP | other *** search
/ ftp.whtech.com / ftp.whtech.com.tar / ftp.whtech.com / club100 / bus / barch1.ba < prev    next >
Text File  |  2006-10-19  |  3KB  |  79 lines

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