Hello everyone,
I have a simple line series graph. Y are values of pressure and X are time values in seconds.
I would like to get Y values based on X (mouse) cursor position. I don't want Y mouse cursor position values but the SERIES Y value based on mouse X position.
For example:
Mouse(2,2) -- series Y value at 2 = 5
Mouse(2,6) -- series Y value at 2 = 5
Mouse(2, 13) -- series Y value at 2 = 5
Best regards,
J
Series Y value based on X position
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Series Y value based on X position
Hi JoJu,
Yes, you can do something like this:
Yes, you can do something like this:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.View3D:=False;
Series1.FillSampleValues;
end;
procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var
startY : Integer;
endY : Integer;
i : Integer;
index : Integer;
yVal : Double;
begin
startY:=Chart1.Axes.Left.IStartPos;
endY:=Chart1.Axes.Left.IEndPos;
for i:=startY to endY do
begin
index:=Series1.Clicked(X, i);
if (index <> TeeNoPointClicked) then
begin
yVal:=Series1.YValues[index];
Chart1.Title.Text[0]:=FloatToStr(yVal);
break;
end;
end;
end;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Series Y value based on X position
Thank you! That is exactly what I needed.
Keep on with the good work!
Keep on with the good work!