09-07-2012 04:13 PM
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
Solved! Go to Solution.
09-08-2012 05:12 AM
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.
09-11-2012 05:56 PM
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