LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Snap to point cursor: How do I determine which axes?

Solved!
Go to solution

I have a graph displaying multiple plots.
Some of the plots use the lower-x and left-y axes.
Others use the upper-x and right-y axes.

 

I use a cursor in snap-to-point mode to select a data point on the plot and display an annotation that indicates the x and y value of the selected point.

 

How do I determine which pair of xy axes are associated with the plot the cursor has snapped to?

 

If I knew this I could use SetCursorAttribute(....) to set ATTR_CURSOR_XAXIS and ATTR_CURSOR_XAXIS to the appropriate value.

 

Thanks,
Kirk
Using Labwindows/CVI 2009

 

0 Kudos
Message 1 of 3
(3,608 Views)
Solution
Accepted by topic author kirkm

You can obtain this by using:

 

GetGraphCursorIndex (panelHandle, controlID, cursorID, &plothandle, &index);
GetPlotAttribute (panelHandle, controlID, plotHandle, ATTR_PLOT_XAXIS, &axis);

You can compare 'axis' variable value with VAL_BOTTOM_XAXIS and VAL_TOP_XAXIS constants to determine X-axis of the plot.

 

The corresponding ATTR_PLOT_YAXIS attribute and VAL_RIGHT_YAXIS, VAL_LEFT_YAXIS constants help you determining the Y axis to which the plot is associated.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 3
(3,604 Views)

Roberto,

 

 

I did not notice that GetGraphCursorIndex(...) returns the plot handle.

That solved my problem nicely!

 

Thank you for you're helpful suggestion, much appreciated.

Kirk

0 Kudos
Message 3 of 3
(3,585 Views)