mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 05:36:22 +02:00
TAChart: Make TConstantLine.AxisIndexX work in GetNearestPoint and MovePoint methods. Update axistransf demo.
git-svn-id: trunk@31953 -
This commit is contained in:
parent
1cb3753a6f
commit
413337fbfa
@ -355,6 +355,7 @@ object Form1: TForm1
|
||||
Source = rcsUser
|
||||
end
|
||||
object ChartUserConstantLine1: TConstantLine
|
||||
AxisIndexX = 1
|
||||
LineStyle = lsVertical
|
||||
Pen.Color = clFuchsia
|
||||
Pen.Width = 2
|
||||
|
@ -105,7 +105,7 @@ procedure TForm1.catUserUserDefinedAxisTransform1AxisToGraph(
|
||||
const
|
||||
R1 = 8.0;
|
||||
C = 2.5;
|
||||
R2 = R1 * 0.5 / C;
|
||||
R2 = R1 / C;
|
||||
var
|
||||
zx: Double;
|
||||
begin
|
||||
|
@ -630,12 +630,12 @@ begin
|
||||
with ParentChart do
|
||||
case LineStyle of
|
||||
lsHorizontal: begin
|
||||
p := YGraphToImage(AxisToGraphX(FPosition));
|
||||
p := YGraphToImage(AxisToGraphX(Position));
|
||||
DrawLineHoriz(ADrawer, p);
|
||||
Arrow.Draw(ADrawer, Point(ClipRect.Right - 1, p), 0);
|
||||
end;
|
||||
lsVertical: begin
|
||||
p := XGraphToImage(AxisToGraphX(FPosition));
|
||||
p := XGraphToImage(AxisToGraphX(Position));
|
||||
DrawLineVert(ADrawer, p);
|
||||
Arrow.Draw(ADrawer, Point(p, ClipRect.Top), -Pi / 2);
|
||||
end;
|
||||
@ -665,11 +665,11 @@ begin
|
||||
// Return the actual nearest point of the line.
|
||||
if LineStyle = lsVertical then begin
|
||||
AValue.Y := FChart.YImageToGraph(APoint.Y);
|
||||
AImg.X := FChart.XGraphToImage(Position);
|
||||
AImg.X := FChart.XGraphToImage(AxisToGraphX(Position));
|
||||
end
|
||||
else begin
|
||||
AValue.X := FChart.XImageToGraph(APoint.X);
|
||||
AImg.Y := FChart.YGraphToImage(Position);
|
||||
AImg.Y := FChart.YGraphToImage(AxisToGraphX(Position));
|
||||
end;
|
||||
SavePosToCoord(AValue);
|
||||
end;
|
||||
@ -683,9 +683,9 @@ procedure TConstantLine.MovePoint(var AIndex: Integer; const ANewPos: TPoint);
|
||||
begin
|
||||
Unused(AIndex);
|
||||
if LineStyle = lsVertical then
|
||||
Position := FChart.XImageToGraph(ANewPos.X)
|
||||
Position := GraphToAxisX(FChart.XImageToGraph(ANewPos.X))
|
||||
else
|
||||
Position := FChart.YImageToGraph(ANewPos.Y);
|
||||
Position := GraphToAxisX(FChart.YImageToGraph(ANewPos.Y));
|
||||
end;
|
||||
|
||||
procedure TConstantLine.SavePosToCoord(var APoint: TDoublePoint);
|
||||
|
Loading…
Reference in New Issue
Block a user