10-10-2008 02:57 PM
Well I thought of a pretty cool VI conceptually, but I can't figure out how to actually execute the code.
I have data that is read from a file, then graphed on an X-Y graph. I have a cursor that displays the x and y values of the current point.
I would like to do the following:
Have an initialized array. Then I manually move the cursor to a point of my choosing, then click a button.
That button will make the x and y value of that point append to the array. Is this possible? Or more importantly, how?
Thanks,
Cory
Solved! Go to Solution.
10-10-2008 03:06 PM
Almost anything is possible. ![]()
What you're asking for is actually quite easy. To do what you want you need to respond to the graph's MouseDown event and then use the graph's Max Coordinates to XY method to get your XY pair. This method will also tell you if you clicked on a point, rather than, say, on the legend.
10-10-2008 03:11 PM
Smercurio, in your example, what is controlling the boolean in the while loop?
It appears that I can only enter a data point once and then the loop stops. Or is that not correct?
10-10-2008 03:18 PM
There's a Stop button on the front panel, and I have a case that handles the button's Value Change event. A fairly standard way with event structures.
Note that the example is a crude, quick-and-dirty one just to get you started. An Issue that you would need to consider is how far away you clicked from the actual curve. The method I showed will return the nearest point, even if you clicked a point that you may consider to be "far away" from the curve, but still within the graphing area. You may, for instance, only want to add the point if you basically clicked right on the point.
10-10-2008 03:20 PM
And I'm still pretty new with LabVIEW. Could you tell me where you found those properties for the graph.
I created a property node, but there are SO MANY properties, could you tell me the sub-heading under properties
where you found those.
Just trying to keep learning, thanks,
Cory
10-10-2008 03:24 PM
It's not a property, it's a method. Remember, I said "use the graph's Max Coordinates to XY method". Right-click on the graph and select Create-> Invoke Node -> Max Coordinates to XY.
Attached is the VI done in LV 8.2.
10-10-2008 03:27 PM
Oh, thats probably why I couldnt find that property, because it isnt a property.
Thanks for your help.
10-10-2008 03:32 PM
When I create an invoke node --> method, I only have 5 methods to choose from,
none of which being the one you stated.
I have:
1) Attach Data Socket
2) Get Image
3) Get Term Image
4) Reinit to Drift
5) Remove Data Socker
Am I still doing something wrong?
(I can't open your VI because I am running 7.1)
10-10-2008 03:39 PM
Since this topic in specific is pretty new to me, does anyone know of anywhere off hand I could learn about 'Methods'.
Like a hyperlink to some NI article or some forum thread or something?
I am self-taught at LabVIEW, so I try to pursue a topic if I don't know it too well.
Thanks
10-10-2008 03:57 PM - edited 10-10-2008 03:58 PM