I am using LabView 2010, expanding on one of the example vis for data acquisition. I want to use graph cursors to allow someone to zoom in on a particular part of a graph. To do so, I have been trying to use property nodes. When a graph has more than one cursor, the property nodes seem to access only the highest indexed cursor. So, I tried to apply a property node to a graph with just one cursor. In particular, I tried to access the x-value of the cursor. When I then run the vi, I get error 1055 "Object reference is invalid". I had hoped to construct the property nodes for one cursor, then add another cursor, and attach property nodes to it. There does not seem to be a way to use property nodes to specify which cursor I am accessing. I have tried a property node with two properties: select cursor as an input, and x-value as an output. The "select cursor" property input seem to have no effect at all.
Is there an example vi for programmatically extracting information from graph cursors?
Solved! Go to Solution.
What precise properties did you try using ? The error you are receiving might indicate that you are using some unsuitable properties for this purpose. You can easily obtain the cursor's X-position on a graph by first selecting the cursor (i.e. writing value "0" to Active cursor -property) and then reading the value from Cursor Position: Cursor X -property.
I hope this helps. Cheers,
Please take a look at my screen shot as a reference for getting the x position for a cursor on a graph object. I hope this helps.
Right clicking on the graph and hover over create then property node, cursor, cursor position then cursor x. This should create a property node that gives the position of the cursor on the graph. I understand you are trying to use multiple cursors but this will get you started.
I have solved the problem, and my code is running fine. I am able to get the info on both cursors and use it. I think that Error 1055 occurred because I had two Property Nodes in my program for the same function. In order to access data on both cursors using the same Property Node, I put a toggle integer into my state machine, to specify the active cursor, so that on one cycle it accesses data on one cursor, and then on the next cycle it accesses data on the other cursor. I save the data using shift registers.
Thank you everyone who tried to make a helpful comment. On this one, I simply needed to set the project aside and come back to it later after jogging.
I intend to upload my code soon, so that others can use my program and build on it. I want to add one more feature first, and a few helpful comments to future programmers. In particular, when a LabView vi terminates, the data is lost. So, I want my program to save the data to a default file upon exiting.
Attached is the LabVIEW2010 GrapherD.vi. It resiliently acquires and saves data to the spreadsheet file of your choice. Data is also always appended to DataDump.xls on your desktop, so that it is not lost upon exiting the vi. Of course, if you force an exit, the data will be lost.
I am putting GrapherD.vi into the public domain. Feel free to use it, copy it, share it, even sell it to your own profit. I ask, but do not require that you give me proper credit if you use the program. I hope that you find it and my comments in it helpful.