Routine that can be adapted to your own programs. The data for the bars is stored in lines 130-155 in pairs, the first being the bar height and the second the dot density. From Nick Hampshire’s Color Graphics.
Content
Source Code
1 PRINT "This barchart routine is one that can be adapted to your own programs. The data for the barsis stored in lines 130-155 in pairs, the first being the bar height and the second the dot density. From Nick Hampshire's ""Color Graphics""."
2 PRINT : PRINT "Press any key for a demo."
3 IF INKEY$="" THEN GO TO 3
4 CLS
60 INK 0
70 PAPER 7: BORDER 3
90 GO SUB 400
100 REM data
130 DATA 20,1,45,2,80,3
135 DATA 22,1,50,2,70,3
140 DATA 25,1,35,2,90,3
145 DATA 35,1,50,2,100,3
150 DATA 30,1,45,2,75,3
155 DATA 40,1,55,2,140,3
170 DATA 0,0
200 REM draw barchart
210 LET b=10
220 READ h,d
230 IF d=0 THEN STOP
240 FOR x=b TO b+5 STEP d
250 FOR y=20 TO h+10 STEP d
260 PLOT x,y
270 NEXT y
280 NEXT x
290 LET b=b+6: REM set start next bar
300 GO TO 220
400 REM border
410 PLOT 0,0
420 DRAW 255,0
430 DRAW 0,175
440 DRAW -255,0
450 DRAW 0,-175
460 RETURN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
