mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-29 17:16:17 +02:00
TAChart: Use IChartDrawer to draw TConstantLine series
git-svn-id: trunk@29624 -
This commit is contained in:
parent
bec3b9be2a
commit
afb0fca7f1
@ -241,8 +241,8 @@ type
|
|||||||
procedure SetChildOrder(Child: TComponent; Order: Integer); override;
|
procedure SetChildOrder(Child: TComponent; Order: Integer); override;
|
||||||
|
|
||||||
public // Helpers for series drawing
|
public // Helpers for series drawing
|
||||||
procedure DrawLineHoriz(ACanvas: TCanvas; AY: Integer);
|
procedure DrawLineHoriz(ADrawer: IChartDrawer; AY: Integer);
|
||||||
procedure DrawLineVert(ACanvas: TCanvas; AX: Integer);
|
procedure DrawLineVert(ADrawer: IChartDrawer; AX: Integer);
|
||||||
procedure DrawOnCanvas(Rect: TRect; ACanvas: TCanvas); deprecated;
|
procedure DrawOnCanvas(Rect: TRect; ACanvas: TCanvas); deprecated;
|
||||||
function IsPointInViewPort(const AP: TDoublePoint): Boolean;
|
function IsPointInViewPort(const AP: TDoublePoint): Boolean;
|
||||||
|
|
||||||
@ -712,16 +712,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TChart.DrawLineHoriz(ACanvas: TCanvas; AY: Integer);
|
procedure TChart.DrawLineHoriz(ADrawer: IChartDrawer; AY: Integer);
|
||||||
begin
|
begin
|
||||||
if (FClipRect.Top < AY) and (AY < FClipRect.Bottom) then
|
if (FClipRect.Top < AY) and (AY < FClipRect.Bottom) then
|
||||||
ACanvas.Line(FClipRect.Left, AY, FClipRect.Right, AY);
|
ADrawer.Line(FClipRect.Left, AY, FClipRect.Right, AY);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TChart.DrawLineVert(ACanvas: TCanvas; AX: Integer);
|
procedure TChart.DrawLineVert(ADrawer: IChartDrawer; AX: Integer);
|
||||||
begin
|
begin
|
||||||
if (FClipRect.Left < AX) and (AX < FClipRect.Right) then
|
if (FClipRect.Left < AX) and (AX < FClipRect.Right) then
|
||||||
ACanvas.Line(AX, FClipRect.Top, AX, FClipRect.Bottom);
|
ADrawer.Line(AX, FClipRect.Top, AX, FClipRect.Bottom);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TChart.DrawOnCanvas(Rect: TRect; ACanvas: TCanvas);
|
procedure TChart.DrawOnCanvas(Rect: TRect; ACanvas: TCanvas);
|
||||||
@ -734,9 +734,9 @@ begin
|
|||||||
if not ADrawer.HasCanvas then exit;
|
if not ADrawer.HasCanvas then exit;
|
||||||
PrepareXorPen(ADrawer.Canvas);
|
PrepareXorPen(ADrawer.Canvas);
|
||||||
if ReticuleMode in [rmVertical, rmCross] then
|
if ReticuleMode in [rmVertical, rmCross] then
|
||||||
DrawLineVert(ADrawer.Canvas, FReticulePos.X);
|
DrawLineVert(ADrawer, FReticulePos.X);
|
||||||
if ReticuleMode in [rmHorizontal, rmCross] then
|
if ReticuleMode in [rmHorizontal, rmCross] then
|
||||||
DrawLineHoriz(ADrawer.Canvas, FReticulePos.Y);
|
DrawLineHoriz(ADrawer, FReticulePos.Y);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TChart.EraseBackground(DC: HDC);
|
procedure TChart.EraseBackground(DC: HDC);
|
||||||
|
@ -256,7 +256,7 @@ type
|
|||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
|
||||||
procedure Draw(ACanvas: TCanvas); override;
|
procedure Draw(ADrawer: IChartDrawer); override;
|
||||||
function GetNearestPoint(
|
function GetNearestPoint(
|
||||||
ADistFunc: TPointDistFunc;
|
ADistFunc: TPointDistFunc;
|
||||||
const APoint: TPoint; out AIndex: Integer; out AImg: TPoint;
|
const APoint: TPoint; out AIndex: Integer; out AImg: TPoint;
|
||||||
@ -270,7 +270,7 @@ type
|
|||||||
property Pen: TPen read FPen write SetPen;
|
property Pen: TPen read FPen write SetPen;
|
||||||
property Position: Double read FPosition write SetPosition;
|
property Position: Double read FPosition write SetPosition;
|
||||||
property SeriesColor: TColor
|
property SeriesColor: TColor
|
||||||
read GetSeriesColor write SetSeriesColor stored false default clTAColor;
|
read GetSeriesColor write SetSeriesColor stored false default clBlack;
|
||||||
property ShowInLegend;
|
property ShowInLegend;
|
||||||
property Title;
|
property Title;
|
||||||
property UseBounds: Boolean read FUseBounds write SetUseBounds default true;
|
property UseBounds: Boolean read FUseBounds write SetUseBounds default true;
|
||||||
@ -596,17 +596,17 @@ begin
|
|||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TConstantLine.Draw(ACanvas: TCanvas);
|
procedure TConstantLine.Draw(ADrawer: IChartDrawer);
|
||||||
begin
|
begin
|
||||||
ACanvas.Brush.Style := bsClear;
|
ADrawer.SetBrushParams(bsClear, clTAColor);
|
||||||
ACanvas.Pen.Assign(FPen);
|
ADrawer.Pen := FPen;
|
||||||
|
|
||||||
with ParentChart do
|
with ParentChart do
|
||||||
case LineStyle of
|
case LineStyle of
|
||||||
lsHorizontal:
|
lsHorizontal:
|
||||||
DrawLineHoriz(ACanvas, YGraphToImage(FPosition));
|
DrawLineHoriz(ADrawer, YGraphToImage(FPosition));
|
||||||
lsVertical:
|
lsVertical:
|
||||||
DrawLineVert(ACanvas, XGraphToImage(FPosition));
|
DrawLineVert(ADrawer, XGraphToImage(FPosition));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user