TAChart: Add Marks.OverlapPolicy property

git-svn-id: trunk@25017 -
This commit is contained in:
ask 2010-04-27 20:40:47 +00:00
parent ce48109571
commit 863906e974
2 changed files with 15 additions and 0 deletions

View File

@ -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

View File

@ -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;