%!PS-Adobe-2.0 %%Title: Blue Book Program 14, on page 187 %%Creator: Adobe Systems Incorporated %%CreationDate: Thu Dec 28 18:14:18 PST 1989 %%EndComments /PieDict 24 dict def PieDict begin /DrawSlice { /grayshade exch def /endangle exch def /startangle exch def /thelabel exch def newpath 0 0 moveto 0 0 radius startangle endangle arc closepath 1.415 setmiterlimit gsave grayshade setgray fill grestore stroke gsave startangle endangle add 2 div rotate radius 0 translate newpath 0 0 moveto labelps .8 mul 0 lineto stroke labelps 0 translate 0 0 transform grestore itransform /y exch def /x exch def x y moveto x 0 lt { thelabel stringwidth pop neg 0 rmoveto } if y 0 lt { 0 labelps neg rmoveto }if thelabel show } def /findgray { /i exch def /n exch def i 2 mod 0 eq { i 2 div n 2 div round add n div } { i 1 add 2 div n div } ifelse } def end /DrawPieChart { PieDict begin /radius exch def /ycenter exch def /xcenter exch def /PieArray exch def /labelps exch def /titleps exch def /title exch def gsave xcenter ycenter translate /Helvetica findfont titleps scalefont setfont title stringwidth pop 2 div neg radius neg titleps 3 mul sub moveto title show /Helvetica findfont labelps scalefont setfont /numslices PieArray length def /slicecnt 0 def /curangle 0 def PieArray { /slicearray exch def slicearray aload pop /percent exch def /label exch def /perangle percent 360 mul def /slicecnt slicecnt 1 add def label curangle curangle perangle add numslices slicecnt findgray DrawSlice /curangle curangle perangle add def } forall grestore end } def (January Pie Sales) 24 12 [ [(Blueberry) .12 ] [(Cherry) .30 ] [(Apple) .26 ] [(Boston Cream) .16 ] [(Other) .04 ] [(Vanilla Cream) .12 ] ] 306 396 140 DrawPieChart showpage