From 413337fbfa2a5df0128d29cb358c4eb6fe294760 Mon Sep 17 00:00:00 2001 From: ask Date: Fri, 12 Aug 2011 06:00:05 +0000 Subject: [PATCH] TAChart: Make TConstantLine.AxisIndexX work in GetNearestPoint and MovePoint methods. Update axistransf demo. git-svn-id: trunk@31953 - --- components/tachart/demo/axistransf/main.lfm | 1 + components/tachart/demo/axistransf/main.pas | 2 +- components/tachart/taseries.pas | 12 ++++++------ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/components/tachart/demo/axistransf/main.lfm b/components/tachart/demo/axistransf/main.lfm index 691bfad464..3239d87922 100644 --- a/components/tachart/demo/axistransf/main.lfm +++ b/components/tachart/demo/axistransf/main.lfm @@ -355,6 +355,7 @@ object Form1: TForm1 Source = rcsUser end object ChartUserConstantLine1: TConstantLine + AxisIndexX = 1 LineStyle = lsVertical Pen.Color = clFuchsia Pen.Width = 2 diff --git a/components/tachart/demo/axistransf/main.pas b/components/tachart/demo/axistransf/main.pas index a99d13c375..630a906b0e 100644 --- a/components/tachart/demo/axistransf/main.pas +++ b/components/tachart/demo/axistransf/main.pas @@ -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 diff --git a/components/tachart/taseries.pas b/components/tachart/taseries.pas index 9d1491aa9f..3221687265 100644 --- a/components/tachart/taseries.pas +++ b/components/tachart/taseries.pas @@ -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);