Page 1 of 1

Click Chart to get Series Value

Posted: Wed Oct 13, 2004 8:07 pm
by 9233233
Let's say I have a chart and a TFastLineSeries.

I click on a coordinate on the *chart*, and I get an X and a Y value (MouseDown or MouseUp, whichever).
Nothing I've seen anywhere (searched for 'click' etc) seems to be able to tell me how I can associate the X coordinate of the mouse (whether it's been converted to the corresponding Axis value or not) with a ValueIndex so that I can do this:

ValueIndex: Integer;
Yvalue: Double;

...
ValueIndex := Series1.SomeFunctionHere(X);
Yvalue := Series1.YValues[ValueIndex];

I do not want to have to click on Series1, since it's thin. Yes, I could go searching around X,Y for a Series1.Clicked(X+dx,Y+dy) but this seems like it's unnecessary.

I'm using TeeChart7 for Delphi 7 if that makes a difference.

Maybe I'm missing something. But I'm quite frustrated now.

Can anyone fill in the missing blanks?

Thanks to all.

Regards,

Matt

Posted: Thu Oct 14, 2004 3:37 pm
by Pep
Hi Matt,

you can use the CalcXPosValue and CalcYPosValue methods :
showmessage( inttostr(Chart1.Axes.Left.CalcYPosValue(Y)));
showmessage( inttostr(Chart1.Axes.Left.CalcXPosValue(X)));
Also, I've posted one example which could be usefull for you into the steema.public.attachments newsgroup ( at news://berneda.com ). It shows how to get the XYValues of the Series using a line like a cursor.

Posted: Fri Oct 15, 2004 1:12 pm
by 9333098
Could you use a Cursor Tool ? Its Snap property determine whether they are locked to the data points or not. If Snap is True, you have to use two Cursor Tools, One for Vert, one for Horiz.

Posted: Fri Oct 15, 2004 1:59 pm
by Pep
Hi Steve,

yes, you should be able to do the same using the Cursor tool.