TAChart: Add TBasicPointSeries.MovePoint overload for graph coordinates

git-svn-id: trunk@38780 -
This commit is contained in:
ask 2012-09-21 11:15:15 +00:00
parent 88ff18a61a
commit ed154f4797
3 changed files with 19 additions and 19 deletions

View File

@ -262,7 +262,7 @@ type
function GetNearestPoint(
const AParams: TNearestPointParams;
out AResults: TNearestPointResults): Boolean; override;
procedure MovePoint(var AIndex: Integer; const ANewPos: TPoint); override;
procedure MovePoint(var AIndex: Integer; const ANewPos: TDoublePoint); override;
property MarkPositions: TLinearMarkPositions
read FMarkPositions write SetMarkPositions default lmpOutside;
property UseReticule: Boolean
@ -1055,15 +1055,12 @@ begin
end;
procedure TBasicPointSeries.MovePoint(
var AIndex: Integer; const ANewPos: TPoint);
var
p: TDoublePoint;
var AIndex: Integer; const ANewPos: TDoublePoint);
begin
if not InRange(AIndex, 0, Count - 1) then exit;
p := FChart.ImageToGraph(ANewPos);
with ListSource do begin
AIndex := SetXValue(AIndex, p.X);
SetYValue(AIndex, p.Y);
AIndex := SetXValue(AIndex, ANewPos.X);
SetYValue(AIndex, ANewPos.Y);
end;
end;

View File

@ -81,7 +81,8 @@ type
procedure Draw(ADrawer: IChartDrawer); virtual; abstract;
function GetGraphBounds: TDoubleRect; virtual; abstract;
function IsEmpty: Boolean; virtual; abstract;
procedure MovePoint(var AIndex: Integer; const ANewPos: TPoint); virtual;
procedure MovePoint(var AIndex: Integer; const ANewPos: TPoint); overload; inline;
procedure MovePoint(var AIndex: Integer; const ANewPos: TDoublePoint); overload; virtual;
property Active: Boolean read FActive write SetActive default true;
property Depth: TChartDistance read FDepth write SetDepth default 0;
@ -1581,11 +1582,17 @@ begin
end;
procedure TBasicChartSeries.MovePoint(
var AIndex: Integer; const ANewPos: TPoint);
var AIndex: Integer; const ANewPos: TDoublePoint);
begin
Unused(AIndex, ANewPos)
end;
procedure TBasicChartSeries.MovePoint(
var AIndex: Integer; const ANewPos: TPoint);
begin
MovePoint(AIndex, FChart.ImageToGraph(ANewPos));
end;
procedure TBasicChartSeries.UpdateMargins(
ADrawer: IChartDrawer; var AMargins: TRect);
begin

View File

@ -269,7 +269,7 @@ type
function GetNearestPoint(
const AParams: TNearestPointParams;
out AResults: TNearestPointResults): Boolean; override;
procedure MovePoint(var AIndex: Integer; const ANewPos: TPoint); override;
procedure MovePoint(var AIndex: Integer; const ANewPos: TDoublePoint); override;
published
property Active default true;
@ -710,21 +710,17 @@ begin
Result := FPen.Color;
end;
procedure TConstantLine.MovePoint(var AIndex: Integer; const ANewPos: TPoint);
procedure TConstantLine.MovePoint(
var AIndex: Integer; const ANewPos: TDoublePoint);
begin
Unused(AIndex);
if LineStyle = lsVertical then
Position := GraphToAxisX(FChart.XImageToGraph(ANewPos.X))
else
Position := GraphToAxisX(FChart.YImageToGraph(ANewPos.Y));
Position :=
GraphToAxisX(TDoublePointBoolArr(ANewPos)[LineStyle = lsHorizontal]);
end;
procedure TConstantLine.SavePosToCoord(var APoint: TDoublePoint);
begin
if LineStyle = lsVertical then
APoint.X := Position
else
APoint.Y := Position;
TDoublePointBoolArr(APoint)[LineStyle = lsHorizontal] := Position;
end;
procedure TConstantLine.SetArrow(AValue: TChartArrow);