TAChart: Add TChartMarks.AutoMargins property

git-svn-id: trunk@39187 -
This commit is contained in:
ask 2012-10-29 14:09:27 +00:00
parent 74b95eaefd
commit 362d125f5b
2 changed files with 15 additions and 1 deletions

View File

@ -1189,7 +1189,7 @@ var
dir: TLabelDirection;
m: array [TLabelDirection] of Integer absolute AMargins;
begin
if not Marks.IsMarkLabelsVisible then exit;
if not Marks.IsMarkLabelsVisible or not Marks.AutoMargins then exit;
for i := 0 to Count - 1 do begin
if not ParentChart.IsPointInViewPort(GetGraphPoint(i)) then continue;

View File

@ -169,11 +169,13 @@ type
FAdditionalAngle: Double;
FArrow: TChartArrow;
FAttachment: TChartMarkAttachment;
FAutoMargins: Boolean;
FFrame: _TFramePen;
FYIndex: Integer;
function GetDistanceToCenter: Boolean;
procedure SetArrow(AValue: TChartArrow);
procedure SetAttachment(AValue: TChartMarkAttachment);
procedure SetAutoMargins(AValue: Boolean);
procedure SetDistance(AValue: TChartDistance);
procedure SetDistanceToCenter(AValue: Boolean);
procedure SetFormat(AValue: String);
@ -209,6 +211,8 @@ type
procedure SetAdditionalAngle(AAngle: Double);
public
property Arrow: TChartArrow read FArrow write SetArrow;
property AutoMargins: Boolean
read FAutoMargins write SetAutoMargins default true;
property DistanceToCenter: Boolean
read GetDistanceToCenter write SetDistanceToCenter
stored false default false;
@ -254,6 +258,7 @@ type
constructor Create(AOwner: TCustomChart);
published
property Arrow;
property AutoMargins;
property CalloutAngle;
property Distance default DEF_MARKS_DISTANCE;
property Format;
@ -596,6 +601,7 @@ begin
if ASource is Self.ClassType then
with TGenericChartMarks(ASource) do begin
Self.FArrow.Assign(FArrow);
Self.FAutoMargins := FAutoMargins;
Self.FAttachment := FAttachment;
Self.FDistance := FDistance;
Self.FFormat := FFormat;
@ -626,6 +632,7 @@ constructor TGenericChartMarks.Create(AOwner: TCustomChart);
begin
inherited Create(AOwner);
FArrow := TChartArrow.Create(AOwner);
FAutoMargins := true;
InitHelper(FFrame, _TFramePen);
InitHelper(FLabelBrush, _TLabelBrush);
InitHelper(FLabelFont, TFont);
@ -706,6 +713,13 @@ begin
StyleChanged(Self);
end;
procedure TGenericChartMarks.SetAutoMargins(AValue: Boolean);
begin
if FAutoMargins = AValue then exit;
FAutoMargins := AValue;
StyleChanged(Self);
end;
procedure TGenericChartMarks.SetDistance(AValue: TChartDistance);
begin
if FDistance = AValue then exit;