19.12.2012 Views

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

SHOW MORE
SHOW LESS

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

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

276 <strong>Computer</strong> <strong>Programming</strong> <strong>Concepts</strong> <strong>and</strong> <strong>Visual</strong> <strong>Basic</strong><br />

Private Sub ShowLegend(maxEnroll As Single) ‘Show legend<br />

picEnroll.Line (.1, 1.05 * maxEnroll)-(.9, .95 * maxEnroll), , BF<br />

Call Locate(1, 1.05 * maxEnroll)<br />

picEnroll.Print “Male”<br />

picEnroll.Line (.1, .9 * maxEnroll)-(.9, .8 * maxEnroll), , B<br />

Call Locate(1, .9 * maxEnroll)<br />

picEnroll.Print “Female”<br />

End Sub<br />

Private Sub ShowTitle(maxEnroll As Single)<br />

‘Display source <strong>and</strong> title Call Locate(-.5, -.1 * maxEnroll)<br />

picEnroll.Print “Source: Statistical Abstract of the United States”<br />

Call Locate(.5, 1.2 * maxEnroll)<br />

picEnroll.Print “Two-Year College Enrollments (in thous<strong>and</strong>s)”<br />

End Sub<br />

FIGURE 9-15 Chart for Example 2<br />

COMMENTS<br />

1. Any line chart can be converted to a bar chart <strong>and</strong> vice versa. Line charts are<br />

best suited for displaying quantities that vary with time. The slopes of the individual<br />

line segments clearly portray the rates at which the quantity is changing.<br />

Bar charts excel in contrasting the magnitudes of different entities.<br />

2. The Line method can produce colored rectangles. If vbColor is one of the 8<br />

color constants, then the statement picBox.Line (x1, y1)–(x2, y2), vbColor, B<br />

draws a rectangle in color. A colored solid rectangle will be produced if B is<br />

replaced by BF. The use of color permits clustered bar charts with three bars per<br />

cluster.<br />

3. In Section 9.4, we discuss a method to fill in rectangles using various patterns,<br />

such as horizontal lines <strong>and</strong> crosshatches. Using this technique, we can create<br />

black-<strong>and</strong>-white clustered bar charts having three or more bars per cluster.

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

Saved successfully!

Ooh no, something went wrong!