mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 21:39:21 +02:00
TAChart: Add new property T(Generic)ChartMarks.LinkDistance to prevent painting the series pointer symbol over the marker arrow.
git-svn-id: trunk@50352 -
This commit is contained in:
parent
bf5fbcb10a
commit
febd26f3f3
@ -163,6 +163,7 @@ type
|
|||||||
strict private
|
strict private
|
||||||
FAdditionalAngle: Double;
|
FAdditionalAngle: Double;
|
||||||
FArrow: TChartArrow;
|
FArrow: TChartArrow;
|
||||||
|
FLinkDistance: Integer;
|
||||||
FAttachment: TChartMarkAttachment;
|
FAttachment: TChartMarkAttachment;
|
||||||
FAutoMargins: Boolean;
|
FAutoMargins: Boolean;
|
||||||
FFrame: _TFramePen;
|
FFrame: _TFramePen;
|
||||||
@ -177,6 +178,7 @@ type
|
|||||||
procedure SetFrame(AValue: _TFramePen);
|
procedure SetFrame(AValue: _TFramePen);
|
||||||
procedure SetLabelBrush(AValue: _TLabelBrush);
|
procedure SetLabelBrush(AValue: _TLabelBrush);
|
||||||
procedure SetLabelFont(AValue: TFont);
|
procedure SetLabelFont(AValue: TFont);
|
||||||
|
procedure SetLinkDistance(AValue: Integer);
|
||||||
procedure SetLinkPen(AValue: _TLinkPen);
|
procedure SetLinkPen(AValue: _TLinkPen);
|
||||||
procedure SetStyle(AValue: TSeriesMarksStyle);
|
procedure SetStyle(AValue: TSeriesMarksStyle);
|
||||||
procedure SetYIndex(AValue: Integer);
|
procedure SetYIndex(AValue: Integer);
|
||||||
@ -214,6 +216,7 @@ type
|
|||||||
property Format: String read FFormat write SetFormat;
|
property Format: String read FFormat write SetFormat;
|
||||||
property Frame: _TFramePen read FFrame write SetFrame;
|
property Frame: _TFramePen read FFrame write SetFrame;
|
||||||
property LabelBrush: _TLabelBrush read FLabelBrush write SetLabelBrush;
|
property LabelBrush: _TLabelBrush read FLabelBrush write SetLabelBrush;
|
||||||
|
property LinkDistance: Integer read FLinkDistance write SetLinkDistance default 0;
|
||||||
property LinkPen: _TLinkPen read FLinkPen write SetLinkPen;
|
property LinkPen: _TLinkPen read FLinkPen write SetLinkPen;
|
||||||
property Style: TSeriesMarksStyle read FStyle write SetStyle;
|
property Style: TSeriesMarksStyle read FStyle write SetStyle;
|
||||||
property YIndex: Integer read FYIndex write SetYIndex default 0;
|
property YIndex: Integer read FYIndex write SetYIndex default 0;
|
||||||
@ -259,6 +262,7 @@ type
|
|||||||
property Format;
|
property Format;
|
||||||
property Frame;
|
property Frame;
|
||||||
property LabelBrush;
|
property LabelBrush;
|
||||||
|
property LinkDistance;
|
||||||
property LinkPen;
|
property LinkPen;
|
||||||
property OverlapPolicy;
|
property OverlapPolicy;
|
||||||
property Style default smsNone;
|
property Style default smsNone;
|
||||||
@ -606,6 +610,7 @@ begin
|
|||||||
Self.FAutoMargins := FAutoMargins;
|
Self.FAutoMargins := FAutoMargins;
|
||||||
Self.FAttachment := FAttachment;
|
Self.FAttachment := FAttachment;
|
||||||
Self.FDistance := FDistance;
|
Self.FDistance := FDistance;
|
||||||
|
Self.FLinkDistance := FLinkDistance;
|
||||||
Self.FFormat := FFormat;
|
Self.FFormat := FFormat;
|
||||||
Self.FFrame.Assign(FFrame);
|
Self.FFrame.Assign(FFrame);
|
||||||
// FPC miscompiles virtual calls to generic type arguments,
|
// FPC miscompiles virtual calls to generic type arguments,
|
||||||
@ -655,10 +660,18 @@ end;
|
|||||||
|
|
||||||
procedure TGenericChartMarks.DrawLink(
|
procedure TGenericChartMarks.DrawLink(
|
||||||
ADrawer: IChartDrawer; ADataPoint, ALabelCenter: TPoint);
|
ADrawer: IChartDrawer; ADataPoint, ALabelCenter: TPoint);
|
||||||
|
var
|
||||||
|
phi: Double;
|
||||||
begin
|
begin
|
||||||
|
if ADataPoint = ALabelCenter then exit;
|
||||||
|
|
||||||
|
with (ADataPoint - ALabelCenter) do phi := ArcTan2(Y, X);
|
||||||
|
if (FLinkDistance <> 0) then
|
||||||
|
ADataPoint := ADataPoint + Point(round(FLinkDistance*cos(phi)), -round(FLinkDistance*sin(phi)));
|
||||||
|
|
||||||
inherited;
|
inherited;
|
||||||
with (ADataPoint - ALabelCenter) do
|
|
||||||
Arrow.Draw(ADrawer, ADataPoint, ArcTan2(Y, X), GetLinkPen);
|
Arrow.Draw(ADrawer, ADataPoint, phi, GetLinkPen);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TGenericChartMarks.GetDistanceToCenter: Boolean;
|
function TGenericChartMarks.GetDistanceToCenter: Boolean;
|
||||||
@ -769,6 +782,13 @@ begin
|
|||||||
StyleChanged(Self);
|
StyleChanged(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TGenericChartMarks.SetLinkDistance(AValue: Integer);
|
||||||
|
begin
|
||||||
|
if FLinkDistance = AValue then exit;
|
||||||
|
FLinkDistance := AValue;
|
||||||
|
StyleChanged(Self);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TGenericChartMarks.SetLinkPen(AValue: _TLinkPen);
|
procedure TGenericChartMarks.SetLinkPen(AValue: _TLinkPen);
|
||||||
begin
|
begin
|
||||||
if FLinkPen = AValue then exit;
|
if FLinkPen = AValue then exit;
|
||||||
|
Loading…
Reference in New Issue
Block a user