LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

exact position of mouse click on xy graph while plotting graph with mouse events

Solved!
Go to solution

hi

iam using xy graph for multi plots

iam plotting graph with mouse move and down events using the attached example (draw graph with mouse events)

 

but  in sub vi Scale Values.vi there are two constants 66 and 30 when i change my plot (i also change the scales) then the mouse position and graph value position(cursor) are not properly aligned but when i change the above mentioned constants i get the perfect alignment between cursor and last point of plot.

 as i switched to another plot (with new scaling) the same problem of misalignment resurfaces.

i need to replace those two constants with something dynamic

please provide assistance

 

regards

mazhar

Message Edited by mazhar.ali on 02-05-2009 04:49 AM
Download All
Message 1 of 8
(10,314 Views)

What about the 'Map Coords TO XY' method:

 

Ton

 

Message Edited by TonP on 02-05-2009 01:36 PM
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 2 of 8
(10,294 Views)

Here's an updated screenshot of your code:

 

My suggestion is to look at my nugget on Dynamic event Registration to limit the event rate when you don't have the mouse down in side the xy-control.

Ton

Message Edited by TonP on 02-05-2009 01:47 PM
Message Edited by TonP on 02-05-2009 01:48 PM
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!
Message 3 of 8
(10,291 Views)

thanx man for your time and interest

your solution is also quite right but

 

iam using cluster of two arrays for my plot.

i have fixed my problem.

now it work fine.

 

regards

mazhar

0 Kudos
Message 4 of 8
(10,259 Views)
Solution
Accepted by topic author mazhar.ali
solution of my problem is
0 Kudos
Message 5 of 8
(10,191 Views)

Your code works...but is not quite there yet. You can get -negative number outside the plot axis values while selecting.

 

You need to constrain the XY mouse coordinates before you push it to your coordinate array. Otherwise you'll get some insane values.

 

Get the X&Y Scale Range:Max\Min and use that to constrain the returned mouse values.

 

Regards

Jack

0 Kudos
Message 6 of 8
(9,689 Views)
Here is the code to check the Axis limits
Message 7 of 8
(9,665 Views)

This is an old post but I forgot the name of the method that that does this so I am happy this info was here. In case someone else is looking here and needs a nice plot tool, I made an VI that finds and highlights the closest data point / trace when a user clicks on an XY Graph.  

 

snip.png

 Just add it to the mouse down event like this: 

Jay14159265_0-1692981180511.png

 

 

 

______________________________________________________________
Have a pleasant day and be sure to learn Python for success and prosperity.
Message 8 of 8
(1,424 Views)