Page 1 of 1

Get Index of Cursor at unknown X or Y Value?

Posted: Fri Feb 02, 2007 3:59 pm
by 9242408
I need to get the index of the position of a cursor at an unknown x or y value. I can get the rest and I seen a GetCursorValueIndex function with the Series Heirarchy and tried it but it didnt return what I needed.

Any ideas?


Thanks,

Tom

Posted: Fri Feb 02, 2007 4:26 pm
by narcis
Hi Tom,

What about doing something as I suggested here in TCursorTool's OnChange event? OnChange's ValueIndex parameter only has valid values when the cursor is set to snap.

Posted: Fri Feb 02, 2007 4:33 pm
by 9242408
narcis wrote:Hi Tom,

What about doing something as I suggested here in TCursorTool's OnChange event? OnChange's ValueIndex parameter only has valid values when the cursor is set to snap.
Yeah I used this code below for the on change event in the cursor:

Code: Select all

curpos: Integer;
curpos := Chart1.Series[seriesidx].XValues.Locate(XValue);
That works good so far. I just have to reset it to 0 if they go past the lastindex point.

Thanks,

Tom