Getting series Index of Mouse X Pos

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Maximus
Newbie
Newbie
Posts: 8
Joined: Fri Apr 02, 2004 5:00 am

Getting series Index of Mouse X Pos

Post by Maximus » Tue Nov 23, 2004 12:01 pm

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

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Tue Nov 23, 2004 3:08 pm

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)"

Maximus
Newbie
Newbie
Posts: 8
Joined: Fri Apr 02, 2004 5:00 am

Post by Maximus » Thu Nov 25, 2004 8:20 am

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
Last edited by Maximus on Thu Nov 25, 2004 10:37 am, edited 1 time in total.

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Thu Nov 25, 2004 9:01 am

Hi,

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

SteveP
Advanced
Posts: 132
Joined: Sun Sep 07, 2003 4:00 am

Post by SteveP » Mon Nov 29, 2004 1:54 pm

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.

Post Reply