Page 1 of 1

TCursortool.Yvalue

Posted: Sat Apr 28, 2007 9:09 am
by 9241087
Hello,

I can read out the vertical position of a horizontal Cursortool by

Code: Select all

TCursortool.YValue
in scales of the axis.

But which axis does this refer to if I have more then one?

In my example I normally have a left and a right vertical axis and I want to read out both YValues of my horizontal Cursor tool.

How can I do this?

Greetings,
Heiko

Posted: Mon Apr 30, 2007 8:14 am
by yeray
Hi Heiko,

Here's an example of how you can show Y values from both left and right axis using OnMouse event instead of Cursor Tool.

Code: Select all

procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  Chart1.Title.Caption := 'LeftAxis Y: ' + floattostr(Chart1.Axes.Left.CalcPosPoint(Y)) + '  RightAxis Y: ' + floattostr(Chart1.Axes.Right.CalcPosPoint(Y));
end;

Difference between two CursorTools

Posted: Sat May 12, 2007 8:14 am
by 9241087
Thanks for the answer. But I think this doesn't help me?

I want (as an example) to get the difference between two horizontal CursorTools. Both in measures of the left and right axis.
This, whenever I move one of the two CursorTools.

For the left axis this is no problem:

Code: Select all

CursorTool.YValue
But what do I have to do with my right axis?

Heiko

Posted: Mon May 14, 2007 9:31 am
by yeray
If you want the difference between the YValues from Cursor Tools associated to different series (associated to different axes) you can simply calculate it but that'll be a difference between values from different scales.
You can also calculate the YValue of a cursor tool for another axis (not associated) like this:

Code: Select all

Chart1.Title.Caption := 'RightAxis Y: ' + floattostr(Chart1.Axes.Right.CalcPosPoint(Chart1.Axes.Left.CalcYPosValue(Cursor1.YValue)));