LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Coordinates of mouse click on diagram

Hello,
 
I'm using LabView 7.1. In my Program I'm using the Plot Multi-XY.vi. Now I want to click with the mouse on the plotted picture and receive the coordinates of this point. Therefore I'm using a event structure. Here I get the two coordinates (vertical, horizontal). My problem is, that the coordinates of the mouse don't match to the coordinates of the plotted diagram. I tried to figure out if something like 10 pixel are 0.01 on the x-axis. But nothing really worked. The coordinates even change when I'm moving the picture on the front panel. Has someone any suggestion what I can do? I added a small part of the program to make clear what I meant.
 
Thank you
Joerg
0 Kudos
Message 1 of 5
(3,300 Views)
The coordinates returned from a Mouse Down events are panel coordinates - there is a point on the panel which is 0,0 (signified by two thicker lines and a diamond at their intersection) and the click refers to those coors. To translate those coords into graph coordinates you would need to use some of the control properties (position and so on) and do some math. Another option would be to use the method shown by CC here, but be sure to read the thread first.

___________________
Try to take over the world!
0 Kudos
Message 2 of 5
(3,294 Views)

Thanks a lot, this helped me very much. Now I can use the cursor. But one small question. With the program I used I was able to put a picture in the background of the plot. Is it also possible with the XY-Graph you mentioned from the other thread?

Once again thanks a lot

Joerg

0 Kudos
Message 3 of 5
(3,287 Views)

I see now. I forgot that the VI you mentioned uses the picture control (the blue wire) and I couldn't look at the code before.

Basically, you have a problem because that method would only work on a graph control and you can't put a picture into a graph control. You can either color the graph transparent and have the picture under it or use the method I suggest earlier for calculating where you clicked. If you open my attachment here you should be able to modify this example to work with the picture control (although you will have to get some of that data not from property nodes).


___________________
Try to take over the world!
0 Kudos
Message 4 of 5
(3,281 Views)
Hi Joerg,

maybe old news but LV 8 and up allows you to set a picture in a graph!

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 5 of 5
(3,272 Views)