This is a versatile program that will enable you to record your expenses, club accounts or any collections you have. You could also use the printouts to impress the boss. It is easy to use and allows a maximum of 40 bars to be drawn of any height. As you key in the data you watch the bar chart grow. After you have done this, you have an option of printing out the bar chart on your printer. After this the height of each is displayed.
How to use it
First you are asked for the labels of the bars in the bar chart. There may be any number but all the labels must fit on one display line. When you have keyed in a line of labels press RETURN once. Then you use the left and right ARROW keys to move a pointer at the bottom of the screen. When the pointer (triangle symbol) is positioned under the label you wish to point to, press the space bar and the bar above the label will increase in height. Each time you press the space bar, the number at the top left hand side of the screen increases by one.
If a bar gets so high that it would go off the screen, then the entire bar chart moves downwards so you are looking at the top half of the bar chart.
If you want to print out the bar chart onto a printer, if you have one, press P. The procedure PROC_DUMP supplied is for printing, using the BBC recommended printer, the Seikosha printer. If you have another one, then replace this with the appropriate screen dump routine. Your dealer, computer magazine or the maker should be able to help you.
If you want to miss out the print out and go straight to the next stage, press S. This section prints out the total for each item of the bar chart.
Programming hints
The program incorporates a scroll downwards. If you list a program, you will notice that if the program has more than around 30 lines the screen scrolls downwards by displaying something on the top screen line and then executing VDU 11 (cursor up). Everything on the screen will now move down one screen line.
This program has been written in MODE 4 because it requires a 40 column screen and yet it must run on a BBC Model A computer, as well as the Model B and Electron. However, MODE 4 only displays two colours. If more colours are required and you have a Model B BBC Micro or an Electron, then you may change it to MODE 1. This will allow red and yellow to be used as well. The COLOUR 129 on line 380 is now red, and can be changed to COLOUR 130 for yellow, or COLOUR 131 for white, to allow red and yellow bars to be displayed as well. The easiest way would be to display bars in different colours, depending upon where on the screen they are displayed. The variable X is the column position of the bar.
10 REM BAR CHARTER 20 REM COPYRIGHT (C) G.LUDINSKI 30 MODE 4 40 DIM Y(40) 50 VDU 19,0,4,0,0,0 60 COLOUR128:COLOUR3 70 CLS 80 LA$=CHR$(136):RA$=CHR$(137) 90 REM 100 REM Input Labels 110 REM 120 PRINTTAB(10,26)"What are the label s" 130 INPUT L$:IF L$="" THEN VDU11:GOTO1 30 140 IF LEN(L$) > 40 THEN VDU11,11:PRIN TTAB(0,28);STRING$(40," ");:VDU11,11:GOT O130 150 PRINTTAB(0,26);STRING$(40," ") 160 S=0:X=1:FORI=1TO40:Y(I)=26:NEXTI 170 *FX4,1 180 SC=0:DT=0 190 REM 200 REM Key In Data 210 REM 220 REPEAT S=S+1 230 I$=GET$:IF I$<>LA$ AND I$<>RA$ A ND I$<>"S" AND I$<>" " AND I$<>"P" AND I $<>"p" THEN 230 240 IF (I$=LA$ AND X=1) OR (I$=RA$ A ND X=40) THEN 230 250 IF I$=" " THEN DT=DT+1:PRINTTAB( 0,2);DT 260 IF I$=LA$ THEN X=X-1 270 IF I$=RA$ THEN X=X+1 280 PRINTTAB(0,30);STRING$(39," ");T AB(X,30)"^"; 290 REM 300 REM Scroll Down If Chart Goes Too High 310 REM 320 IF Y(X)+SC >=0 THEN GOTO370 330 COLOUR0:COLOUR128:PRINTTAB(0,0)"S" ;:VDU11:PRINTTAB(0,3)" "TAB(0,27);STRIN G$(199," ");:COLOUR1:PRINTTAB(0,2);DT;TA B(0,28);L$;:SC=SC+1 340 REM 350 REM Add More To Bar 360 REM 370 IF I$<>" " THEN 410 380 COLOUR0:COLOUR129 390 YT=Y(X)+SC:IF YT>26 THEN YT=26 400 PRINTTAB(X,YT)" ";:Y(X)=Y(X)-1:COL OUR1:COLOUR128 410 UNTIL I$="S" OR I$="s" OR I$="P" O R I$="p" 420 IF I$="P" OR I$="p" THEN PROC_DUMP 430 REM 440 REM Totals 450 REM 460 CLS 470 PRINTTAB(17,1)"Totals"TAB(17,2)"-- ----"'' 480 FORI=1 TO 40 490 PRINTMID$(L$,I,1);" ";:IF 26-Y(I )<>0 THEN PRINT26-Y(I); 500 PRINT 510 IF I=26 THEN PRINT"Press <RETURN > to continue";:REPEATUNTILGET=13:CLS:PR INT'' 520 NEXTI 530 *FX4 0 540 GOTO 700 550 DEFPROC_DUMP 560 VDU2,1,8 570 FORY=1023 TO 0 STEP -28 580 FORX=0 TO 1279 STEP 4 590 CH=1 600 FOR D=27 TO 0 STEP -4 610 CH=CH*2 620 IF POINT(X,Y-D)>0 THEN CH=CH +1 630 NEXT 640 VDU1,CH 650 NEXT 660 VDU1,10 670 NEXT 680 VDU1,15,3 690 ENDPROC 700 END