12.07.2015 Views

williams-et-al-1983-apple-ii-computer-graphics

williams-et-al-1983-apple-ii-computer-graphics

williams-et-al-1983-apple-ii-computer-graphics

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 11-GRAPHS AND CHARTS 12 1480 REM490 REM SET NEW COLOR500 REM510 C% = INT (15 * RND (1) + 1)520 IF C% = 5 OR CO% = C% GOTO 510530 COLOR = C.%540 CO% = C%550 REM560 REM PLOT A BAR AND PRINT LABEL570 REM580 HTAB ( XS + 1) : VTAB (21)590 PRINT LEFT$ (LBL$(I),WB%) ;600 FOR X = XS TO XS + WB%-1610 IF X > 39 THEN PRINT CHR$ (7) ;· "CHART TOO WIDE" : GOTO 670620 IF H% THEN HLIN 0 , BAR(I) * SCL AT X630 IF NOT (H%) THEN VLIN 39, 39-BAR(I) * SCL AT X640 NEXT X650 XS = X + WS%660 NEXT I670 END0·0 REM705 REM **************710 REM * DATA TABLE *715 REM **************720 REM730 DATA 4,5,2740 DATA 100' I 80750 DATA 80 ,'81760 DATA 50 , '82770 DATA 40 , '83Listing 11-1. Bar graphs.This routfne draws either horizont<strong>al</strong> or vertic<strong>al</strong> bars. Select the vertic<strong>al</strong>bar graph option when the <strong>computer</strong> screen displays:PRESS 0 FOR A VERTICAL CHARTPRESS 1 FOR A HORIZONTAL CHARTYou will see the bar chart appear with labels underneath to indicateyears. If you run the program again and select a horizont<strong>al</strong> graph, theyears sti ll appear at the bottom. Why? This happens because it is notpossible to put text labels in the body of the Low-Res screen. As you willsee in Listing 11-3, labels are often unique to each graph, and many timesthey have to be added after the graph is done, and in a less than elegantmanner.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!