From 863906e9745c15c157790515e3876d5f8eba246e Mon Sep 17 00:00:00 2001 From: ask Date: Tue, 27 Apr 2010 20:40:47 +0000 Subject: [PATCH] TAChart: Add Marks.OverlapPolicy property git-svn-id: trunk@25017 - --- components/tachart/taseries.pas | 1 + components/tachart/tatypes.pas | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/components/tachart/taseries.pas b/components/tachart/taseries.pas index e03b03aab8..7f89dae177 100644 --- a/components/tachart/taseries.pas +++ b/components/tachart/taseries.pas @@ -583,6 +583,7 @@ procedure TBasicPointSeries.DrawLabels(ACanvas: TCanvas); with center do labelRect := BoundsSize(X - sz.cx div 2, Y - sz.cy div 2, sz); if + (Marks.OverlapPolicy = opHideNeighbour) and not IsRectEmpty(FPrevLabelRect) and IntersectRect(dummy, labelRect, FPrevLabelRect) then diff --git a/components/tachart/tatypes.pas b/components/tachart/tatypes.pas index 26d839ecdf..1afeb945db 100644 --- a/components/tachart/tatypes.pas +++ b/components/tachart/tatypes.pas @@ -105,6 +105,8 @@ type property Visible default false; end; + TChartMarksOverlapPolicy = (opIgnore, opHideNeighbour); + { TGenericChartMarks } generic TGenericChartMarks<_TLabelBrush, _TLinkPen, _TFramePen> = @@ -117,6 +119,7 @@ type FLabelBrush: _TLabelBrush; FLabelFont: TFont; FLinkPen: _TLinkPen; + FOverlapPolicy: TChartMarksOverlapPolicy; FStyle: TSeriesMarksStyle; procedure SetClipped(const AValue: Boolean); @@ -126,6 +129,7 @@ type procedure SetLabelBrush(const AValue: _TLabelBrush); procedure SetLabelFont(const AValue: TFont); procedure SetLinkPen(const AValue: _TLinkPen); + procedure SetOverlapPolicy(AValue: TChartMarksOverlapPolicy); procedure SetStyle(const AValue: TSeriesMarksStyle); protected function IsMarginRequired: Boolean; @@ -151,6 +155,8 @@ type property Distance: TChartDistance read FDistance write SetDistance; property Format: String read FFormat write SetFormat; property LabelFont: TFont read FLabelFont write SetLabelFont; + property OverlapPolicy: TChartMarksOverlapPolicy + read FOverlapPolicy write SetOverlapPolicy default opIgnore; property Style: TSeriesMarksStyle read FStyle write SetStyle; property Visible default true; end; @@ -421,6 +427,7 @@ begin InitHelper(FLabelBrush, _TLabelBrush); InitHelper(FLabelFont, TFont); InitHelper(FLinkPen, _TLinkPen); + FOverlapPolicy := opIgnore; FStyle := smsNone; FVisible := true; end; @@ -533,6 +540,13 @@ begin StyleChanged(Self); end; +procedure TGenericChartMarks.SetOverlapPolicy(AValue: TChartMarksOverlapPolicy); +begin + if FOverlapPolicy = AValue then exit; + FOverlapPolicy := AValue; + StyleChanged(Self); +end; + procedure TGenericChartMarks.SetStyle(const AValue: TSeriesMarksStyle); begin if FStyle = AValue then exit;