TAChart: Add new property MarkDistancePercent to TPieSeries.

git-svn-id: trunk@58447 -
This commit is contained in:
wp 2018-07-06 12:17:50 +00:00
parent f0b79df6e0
commit b620802ae8
2 changed files with 13 additions and 1 deletions

View File

@ -62,6 +62,7 @@ type
TCustomPieSeries = class(TChartSeries) TCustomPieSeries = class(TChartSeries)
private private
FCenter: TPoint; FCenter: TPoint;
FMarkDistancePercent: Boolean;
FMarkPositions: TPieMarkPositions; FMarkPositions: TPieMarkPositions;
FRadius: Integer; FRadius: Integer;
FSlices: array of TPieSlice; FSlices: array of TPieSlice;
@ -74,6 +75,7 @@ type
procedure SetEdgePen(AValue: TPen); procedure SetEdgePen(AValue: TPen);
procedure SetExploded(AValue: Boolean); procedure SetExploded(AValue: Boolean);
procedure SetFixedRadius(AValue: TChartDistance); procedure SetFixedRadius(AValue: TChartDistance);
procedure SetMarkDistancePercent(AValue: Boolean);
procedure SetMarkPositions(AValue: TPieMarkPositions); procedure SetMarkPositions(AValue: TPieMarkPositions);
procedure SetRotateLabels(AValue: Boolean); procedure SetRotateLabels(AValue: Boolean);
function SliceColor(AIndex: Integer): TColor; function SliceColor(AIndex: Integer): TColor;
@ -99,6 +101,8 @@ type
property Exploded: Boolean read FExploded write SetExploded default false; property Exploded: Boolean read FExploded write SetExploded default false;
property FixedRadius: TChartDistance property FixedRadius: TChartDistance
read FFixedRadius write SetFixedRadius default 0; read FFixedRadius write SetFixedRadius default 0;
property MarkDistancePercent: Boolean
read FMarkDistancePercent write SetMarkDistancePercent default false;
property MarkPositions: TPieMarkPositions property MarkPositions: TPieMarkPositions
read FMarkPositions write SetMarkPositions default pmpAround; read FMarkPositions write SetMarkPositions default pmpAround;
property RotateLabels: Boolean property RotateLabels: Boolean
@ -465,6 +469,13 @@ begin
UpdateParentChart; UpdateParentChart;
end; end;
procedure TCustomPieSeries.SetMarkDistancePercent(AValue: Boolean);
begin
if FMarkDistancePercent = AValue then exit;
FMarkDistancePercent := AVAlue;
UpdateParentChart;
end;
procedure TCustomPieSeries.SetRotateLabels(AValue: Boolean); procedure TCustomPieSeries.SetRotateLabels(AValue: Boolean);
begin begin
if FRotateLabels = AValue then exit; if FRotateLabels = AValue then exit;
@ -534,7 +545,7 @@ function TCustomPieSeries.TryRadius(ADrawer: IChartDrawer): TRect;
var var
d: Double; d: Double;
begin begin
d := Marks.Distance; d := IfThen(FMarkDistancePercent, Marks.Distance * FRadius / 100, Marks.Distance);
if not Marks.DistanceToCenter then if not Marks.DistanceToCenter then
d += LabelExtraDist(p, AAngle); d += LabelExtraDist(p, AAngle);
Result := EndPoint(AAngle, d); Result := EndPoint(AAngle, d);

View File

@ -119,6 +119,7 @@ type
property Depth; property Depth;
property Exploded; property Exploded;
property FixedRadius; property FixedRadius;
property MarkDistancePercent;
property MarkPositions; property MarkPositions;
property RotateLabels; property RotateLabels;
property Source; property Source;