From 362d125f5b9e84d01483fe7856f03b386a8e11d9 Mon Sep 17 00:00:00 2001 From: ask Date: Mon, 29 Oct 2012 14:09:27 +0000 Subject: [PATCH] TAChart: Add TChartMarks.AutoMargins property git-svn-id: trunk@39187 - --- components/tachart/tacustomseries.pas | 2 +- components/tachart/tatextelements.pas | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/components/tachart/tacustomseries.pas b/components/tachart/tacustomseries.pas index 892bc1f7c5..8ad1291b0c 100644 --- a/components/tachart/tacustomseries.pas +++ b/components/tachart/tacustomseries.pas @@ -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; diff --git a/components/tachart/tatextelements.pas b/components/tachart/tatextelements.pas index 0e92c7fd34..801aef1e92 100644 --- a/components/tachart/tatextelements.pas +++ b/components/tachart/tatextelements.pas @@ -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;