Program:
"Please wait...
Drawing Pie Chart"
1 DISP
(66,32) 20 0 6.28
ARC
PICT RCL LCD
RCL... TOT /
DUP 100 *
prcnts
«
2 ‡ NUM * *
0
prop angle
«
prop SIZE OBJ
DROP SWAP
FOR n
(66,32) prop n GET
'angle' STO+
angle COS angle SIN
RC 20 * OVER +
LINE
PICT RCL
angle prop n GET
2 / - DUP DUP
COS SWAP SIN RC
26 * (66,32) +
SWAP
CASE
DUP 1.5 ‰
THEN
DROP
END
DUP 4.4 ‰
THEN
DROP 15 -
END
Comments:
Displays "drawing" message.
Draws the circle.
Displays the empty circle.
Recalls the statistics data
matrix, computes totals, and
calculates the proportions.
Converts the proportions to
percentages.
Stores the percentage matrix in
prcnts.
Multiplies the proportion matrix
by 2 , and enters the initial
angle (0).
Stores the angle matrix in prop
and angle in angle.
Sets up 1 to m as loop counter
range.
Begins loop-clause.
Puts the center of the circle on
the stack, then gets the nth
value from the proportion
matrix and adds it to angle.
Computes the endpoint and
draws the line for the nth slice.
Recalls PICT to the stack.
For labeling the slice, computes
the midpoint of the arc of the
slice.
Starts the CASE structure to
test angle and determine the
offset value for the label.
From 0 to 1.5 radians, doesn't
offset the label.
From 1.5 to 4.4 radians, offsets
the label 15 user units left.
RPL Programming Examples 2-35