' *** PIE_DIAG.LST *** 2nd GFA-Manual, page 6-7 > PROCEDURE pie_diagram(VAR n()) ' ' *** Positive numbers are represented as percentage in pie-diagram ' *** Not more than 24 numbers in word-array allowed ' *** For High and Medium resolution only ' ' *** Standard: char.width& char.height& high.res! med.res! ' x.max& y.max& ' LOCAL n.max,i,sum%,q#,p.end#,p.start#,ps#,pu#,psa#,x#,y#,x,y,rx,ry CLS n.max=PRED(DIM?(n())) FOR i=0 TO n.max ADD sum%,n(i) NEXT i DIM n.fract#(n.max) q#=2*PI/sum% FOR i=0 TO n.max n.fract#(i)=n(i)*q# ! 2*PI = 100 % NEXT i IF high.res! x=x.max/2 y=y.max/2-20 rx=x-20 ry=y-30 ELSE IF med.res! x=x.max/2 y=y.max/2-10 rx=x-20 ry=y-15 ENDIF FOR i=0 TO n.max p.end#=p.start#+n.fract#(i)*57.3 DEFFILL 1,2,i ! new Fill-pattern (max. 24) PELLIPSE x,y,rx,ry,10*p.start#+2700,10*p.end#+2700 p.start#=p.end# NEXT i DEFTEXT ,,,13 FOR i=0 TO n.max ps#=psa#+n.fract#(i) pu#=0.5*(ps#+psa#) x#=70*SIN(pu#)+54 y#=25*COS(pu#)+34 TEXT (x#/2+12.5)*char.width,(y#/3)*char.height+4,STR\$(n(i)) psa#=ps# NEXT i ERASE n.fract#() RETURN ' ********* '