LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

click mouse on the plot to show data source

Hi,

I have up to 10 plots in a graph and want to implement the following feature: left click on a plot to pop up a comment box that indicates where this plot comes from. How can I retrieve the information of the mouse-click position and compare with the plot handles to see if it is picking some plot?

Thanks for your help,
wmf

Message Edited by wmf on 08-22-2006 05:45 PM

0 Kudos
Message 1 of 4
(3,418 Views)

If you have enabled cursors on the graph control, then you can use GetGraphCursorIndex() (within the EVENT_COMMIT graph callback) to identify the plot that the cursor has snapped to (ie the nearest plotted point when you left-click the mouse).

JR

0 Kudos
Message 2 of 4
(3,399 Views)
JR

Thanks for your answer. I have a few questions about cursor.
How can I compare Index to the mouse-click position?
Do I need to define a cursor for each plot (snap to it)?
Can I set them be "no point", "no cross" in code otherwise the graph will be too crowded?

Regards,
wmf
0 Kudos
Message 3 of 4
(3,385 Views)
You define a cursor on the control, not on each plot; ie just once, in the UIR editor.
 
When you draw your (10) plots on the graph, you will obtain a handle for each one. It is this value that is returned by the GetGraphCursorIndex() function, so it is easy for you to check to see which plot the cursor has snapped to.
 
My applications using this approach used a cursor with a "Simple Dot" in a "Vertical Line" - as there needs to be only a single cursor for your whole graph, not one for each plot, this should not clutter your display too much. I remember there was an issue with some of the cursor styles which caused unexpected operation - I cannot remember what this was now but if you start off with these settings and get it working it would be easy enough to change them and see what happens.
 
JR
0 Kudos
Message 4 of 4
(3,379 Views)