HORIZONTAL BAR CHART is a routine in BASIC for the TS2068 with an attached TS2040 printer. The purpose of the routine is two-fold. One, it is a relatively short program that provides a bar chart to illustrate the comparative status of a number of items (up to 20) in an inventory. Two, it demonstrates one way in which the 2040 printer can print out and “couple” automatically several screens full of data, and print it as a single illustration.
This program will print out one screen full, or two screens full, as the number of items requires.
For example, we input data on 15 assumed and related items, in this case various fruits. We also included make-believe quatities and a title, in response to LINE 55 of the program. The routine is universal. You may enter any related items and respective quantities. The item name is limited to 12 characters, in LINE 20. We also elected to call this FIGURE 1, but again, this may be changed to suit your application. Usually bar charts are used for a group of related items of 5 or more. Less than this and a pie chart may be a better choice.
In order to understand the arithmetic of the PLOT and PRINT AT lines, such as 240, 250, 630 and 640, you should refer to a screen chart for the computer. There is one on page 152 of the User Manual.

1 REM ** HORIZONTAL BAR CHART
2 REM ** "D-30", 3-17-88, WF
5 REM ** ENTER DATA
8 LET max=0: POKE 23658,8
10 INPUT "How many items, 5 to 20? ";I
15 IF I>20 THEN GO TO 10
20 DIM A$(I,12): DIM Q(I)
30 FOR n=1 TO I
40 INPUT "Enter item No. ";(n);", and quantity ";A$(n),Q(n)
45 IF Q(n)>max THEN LET max=Q(n)
50 NEXT n
55 INPUT "Enter title. Maximum of 32 characters.";B$
200 REM ** PLOT DATA
210 LET V=160
220 FOR m=1 TO I
230 FOR n=0 TO 2
240 PLOT 0,V+8+n: DRAW 253*Q(m)/max,0: NEXT n
250 PRINT AT 21-V/8,1;A$(m);" = ";Q(m);" units."
260 LET V=V-16
270 IF m=10 AND I=10 OR m>10 AND I>10 THEN GO TO 500
280 NEXT m
290 PRINT AT 19,16-LEN B$/2;B$;AT 20,12;"FIGURE 1"
300 PLOT 0,0: DRAW 0,175: DRAW 255,0: DRAW 0,-175: DRAW -255,0: COPY : STOP
500 PLOT 0,0: DRAW 0,175: DRAW 255,0: DRAW 0,-175: COPY : CLS
510 IF I>=12 THEN GO SUB 600
520 PRINT AT 19,16-LEN B$/2;B$;AT 20,12;"FIGURE 1"
530 PLOT 0,175: DRAW 0,-175: DRAW 255,0: DRAW 0,175: COPY : STOP
600 REM ** PLOT CONTINUATION of DATA
605 LET V=160
610 FOR m=12 TO I
620 FOR n=0 TO 2
630 PLOT 0,V+8+n: DRAW 253*Q(m)/max,0: NEXT n
640 PRINT AT 21-V/8,1;A$(m);" = ";Q(m);" units."
650 LET V=V-16
670 NEXT m: RETURN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.