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...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 11-GRAPHS AND CHARTS 127These lines load the shape table from disk, and tell the system where it was·put. (See Chapter 10.)300 DIM DP (NP%-1)310 FOR I = 0 TO NP%-1320 READ DP(I)330 IF MAX < DP (I) THEN MAX340 NEXT I380 SCL = 150 I MAXDP(I)These lines read the data points into an array c<strong>al</strong>led DP and establish themaximum and the sc<strong>al</strong>ing factor. Thanks to line 380 the maximum point isplotted at Y-coordinate 150.400 REM DRAW FRAME420 HGR430 HCOLOR = 6440 HPLOT 24,0 TO 24, 159 TO 278,159 TO 278,0 TO 24,0Here a blue frame is drawn for the graph, and space is provided on the leftside for the labels.500 REM SCALE VERTICAL AXIS520 HCOLOR = 3530 FOR I = 20 TO MAX STEP 20540 ROT = 16 : DRAW 11 AT 24, 160-I * SCL550 ROT = 0560 N$ = STR$ (I) :NL = LEN (N$)570 FOR J 1 TO NL580 DIGIT = VAL ( MID$ (N$,J,1 )): IFDIGIT = 0 THEN DIGIT = 10590 DRAW DIGIT AT (J-1) * 7,160-I * SCL600 NEXT J610 NEXT IHere we . sc<strong>al</strong>e the vertic<strong>al</strong> by 20. If you wished to use a diffe rent sc<strong>al</strong>e,such as 10, you would change both occurrences of 20 in line 530 to 10.Line 540 rotates our little tic-mark (shape 11) and draws it across the axis.Line 550 r<strong>et</strong>urns the rotation to 0 and the section from lines 560 through600 proceeds to take each digit of the label (I) and draws it on the Hi-Resscreen by means of the shape table.630 REM SCALE HORIZONTAL AXIS650 ROT = 0660 FOR I = 1 TO NP% - 1670 X = 24 + I * SP%680 IF X < 280 THEN DRAW 11 AT X , 159690 NEXT I7(l VTAB (21)

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

Saved successfully!

Ooh no, something went wrong!