mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-02 00:59:17 +02:00
TAChart: Implement left/right mark positions for pie series
git-svn-id: trunk@30573 -
This commit is contained in:
parent
bfb3e89980
commit
22f53e500e
@ -38,7 +38,7 @@ type
|
|||||||
FLabel: TLabelParams;
|
FLabel: TLabelParams;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TPieMarkPositions = (pmpAround, pmpInside);
|
TPieMarkPositions = (pmpAround, pmpInside, pmpLeftRight);
|
||||||
|
|
||||||
{ TCustomPieSeries }
|
{ TCustomPieSeries }
|
||||||
|
|
||||||
@ -333,7 +333,12 @@ function TCustomPieSeries.TryRadius(ADrawer: IChartDrawer): TRect;
|
|||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
p: TPointArray;
|
p: TPointArray;
|
||||||
d: TPoint;
|
|
||||||
|
function Ofs(AAngle: Double): TPoint;
|
||||||
|
begin
|
||||||
|
Result := EndPoint(AAngle, Marks.Distance + LabelExtraDist(p, AAngle));
|
||||||
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
with ALabel do begin
|
with ALabel do begin
|
||||||
FCenter := FAttachment;
|
FCenter := FAttachment;
|
||||||
@ -343,10 +348,13 @@ function TCustomPieSeries.TryRadius(ADrawer: IChartDrawer): TRect;
|
|||||||
if RotateLabels then
|
if RotateLabels then
|
||||||
Marks.SetAdditionalAngle(AAngle);
|
Marks.SetAdditionalAngle(AAngle);
|
||||||
p := Marks.GetLabelPolygon(ADrawer, ADrawer.TextExtent(FText));
|
p := Marks.GetLabelPolygon(ADrawer, ADrawer.TextExtent(FText));
|
||||||
d := EndPoint(AAngle, Marks.Distance + LabelExtraDist(p, AAngle));
|
|
||||||
case MarkPositions of
|
case MarkPositions of
|
||||||
pmpAround: FCenter += d;
|
pmpAround:
|
||||||
pmpInside: FCenter -= d;
|
FCenter += Ofs(AAngle);
|
||||||
|
pmpInside:
|
||||||
|
FCenter -= Ofs(AAngle);
|
||||||
|
pmpLeftRight:
|
||||||
|
FCenter += Ofs(IfThen(InRange(AAngle, Pi / 2, 3 * Pi / 2), Pi, 0));
|
||||||
end;
|
end;
|
||||||
for i := 0 to High(p) do
|
for i := 0 to High(p) do
|
||||||
ExpandRect(Result, p[i] + FCenter);
|
ExpandRect(Result, p[i] + FCenter);
|
||||||
|
Loading…
Reference in New Issue
Block a user