Page 1 of 1

Getting series Index of Mouse X Pos

Posted: Tue Nov 23, 2004 12:01 pm
by 9336976
Hi,

I've got a chart showing Measurements over Time using TFastLineSeries lines. The measurement result (amplitude) is plotted on the Y axis and the time scale is plotted on the X axis.

I also store detailed information about each measurement in a seperate array. The series line is filled using values from this array, meaning that each point in the series lines corresponds to an element in the array.

I have now added a vertical-line based CursorTool to the chart and would like to know the Index of the seriesline the cursor is currently over. When the user moves the vertical cursor line over the chart I would like to show the user the rest of the details for the area the cursor is currently over. I don't want to use the GetCursorValueIndex function since this looks at both the X and Y axis and the user has to move the mouse over the thin series line, which is understandebly quite difficult.

Any help will be greatly appreciated!

Delphi 7
TeeChart Pro 7

Posted: Tue Nov 23, 2004 3:08 pm
by Pep
Hi,

you can see one example which shows how to accomplish this in the steema.public.attachments newsgroup in a message with subject :
"RE: Click Chart to get Series Value (Matt)"

Posted: Thu Nov 25, 2004 8:20 am
by 9336976
The TCursorTool ended up giving me the perfect solution. When setting the Snap property to True for the TCursorTool, it provides me with the ValueIndex in it's OnChange event handler. This is exactly what I needed! I found the solution in the TeeChart 7 Pro Demo under All Futures -> Tools -> Cursors -> Synchronizing Two. The best part is I practically didn't have to write a single line of code! :D

Posted: Thu Nov 25, 2004 9:01 am
by Pep
Hi,

great !.. I'm glad to hear this..

Posted: Mon Nov 29, 2004 1:54 pm
by 9333098
I believe the CursorTool's OnChange event fires every time the mouse pixel changes, even if the actual ValueIndex that it Snaps to has not changed. This may result in unnecessary multiple event firing. There is the OnSnapChange event which avoids this.