home *** CD-ROM | disk | FTP | other *** search
- (***********************************************************)
- (* *)
- (* TURBO GRAPHIX version 1.06A *)
- (* *)
- (* Pie chart module *)
- (* Module version 1.06A *)
- (* *)
- (* Copyright (C) 1985 by *)
- (* BORLAND International *)
- (* *)
- (***********************************************************)
-
- procedure DrawCartPie(X1, Y1, X2, Y2, Inner, Outer : real;
- A : PieArray; N, Prior, Scale : integer);
- var
- I : integer;
- Sum, AspectLoc : real;
-
- procedure DCS(N : integer);
- begin
- DrawCircleSegment(X1, Y1, X2, Y2, Inner, Outer, abs(A[N].Area / Sum * 360),
- A[N].Area, A[N].Text, Prior, Scale);
- end; { DCS }
-
- begin { DrawCartPie }
- AspectLoc := AspectGlb;
- AspectGlb := AspectGlb * BXGlb / BYGlb;
- Sum := 0.0;
- for I := 1 to N do
- Sum := Sum + abs(A[I].Area);
- for I := 1 to N - 1 do
- begin
- PieGlb := (A[I].Area > 0) and (A[I + 1].Area > 0);
- DCS(I);
- end;
- PieGlb := (A[N].Area > 0) and (A[1].Area > 0);
- DCS(N);
- PieGlb := true;
- AspectGlb := AspectLoc;
- end; { DrawCartPie }
-
- procedure DrawPolarPie(X1, Y1, Radius, Angle, Inner, Outer : real;
- A : PieArray; N, Prior, Scale : integer);
- begin
- Angle := Angle / 180 * Pi;
- DrawCartPie(X1, Y1, X1 + Cos(Angle) * Radius, Y1 + Sin(-Angle) * Radius,
- Inner, Outer, A, N, Prior, Scale);
- end; { DrawPolarPie }