From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LV7 How to click on an xy chart and identify the data point selected

I have an xy chart displaying a time chart showing points when faults were identified, and want the user to be able to touch the plot area and for that data point to be identified so that the main display can be switched to the appropriate data.

I have a solution where I drag the cursor to the required point then use Mouse Up event to read the cursor value, then search the data array for the matching cursor value and get the solution.
However this is on a touch screen UI and dragging to cursor does not work very well. What I would like is to be able to convert the mouse position (relative to the full screen) and convert this to the position on the plot area that is given by the cursor position.
I
f someone could tell me how to get the screen position of the plot area rather than the full bounds of the xy control I think I could do it.
0 Kudos
Message 1 of 5
(3,064 Views)
Check out the LabVIEW demo found in your LabVIEW install folder. e.g. a normal install under windows places it at:

C:\Program Files\National Instruments\LabVIEW 7.0\examples\general\uievents.llb\Draw Graph with Events.vi

(Or search for e.g. "mouse" in the Example Finder. The VI is "Draw Graph with Events.vi".
0 Kudos
Message 2 of 5
(3,064 Views)
Thanks for the answer, I will use that method.

However the solution isn't quite general purpose as I'd have liked it uses constants to offset the position of the top & left plot area, and if these are changed the cursor is offset. (The plot area does move automatically if axis number format or just the size of the y-axis values change.)

I'd still like to find a way of finding the plot area position programatically - I've needed this a few times elsewhere in my program.
For instance I have a cluster of buttons matched up to points on a graph that is programmatically resized depending on the number of tooling heads on the machine I'm monitoring and it doesn't always align to the plot.
0 Kudos
Message 3 of 5
(3,064 Views)
Yes, I agree it is not very pratical. I would prefer if the true x,y coordinates could be obtained directly in the event structure.

In addition to the "Coords" terminal, we also need a terminal that provides the coordinates directly in the true plot units. That would definitely be very useful.

Make sure to suggest it to NI (I have, long ago!).
0 Kudos
Message 4 of 5
(3,064 Views)

hello,

 

i know its a very old post, but is there a neat solution for this (true X,Y co-ordinates) ? i am running into same problem

 

any help is appreciated.

0 Kudos
Message 5 of 5
(2,453 Views)