NI Home > Community > NI Discussion Forums
Reply
Member
tlicquia
Posts: 4

How do I make an XY-Graph plot points over time?

I am building a program to plot and take data of a relationship between two voltages.  One is voltage is uniquely dependent on the other.  So far I have successfully built an XY-Graph to plot the voltages against each other (Voltage1 along the x-axis and Voltage2 along the y-axis).  However, the XY-Graph only diplays the point (V1, V2) at the instantaneous time I am looking at it, and does not continuously plot different points as I vary the independent voltage.  I need the graph to display all the points that occur as I vary the independent voltage.  As of right now, all I see is one little cursor that moves all over the graph as I vary it.  My program consists of a While Loop that contains all of the following:  two seperate data anolog input functions that take both voltage separately from my board.  The the output samples from each 'AI Sample' function are then bundled into one cluster using the 'bundle' function.  The cluster output from the 'bundle' function is then wired to a 'build array' function.  The 1-D array output from the 'build array' function is then wired to my 'XY-Graph'.  How do I get the XY-Graph to plot a point every millisecond or so?
Knight of NI
Dennis_Knutson
Posts: 31,961

Re: How do I make an XY-Graph plot points over time?

[ Edited ]

Bundling and then using the Build Array is not correct. Yuo can see the correct method in the help for an XY Graph below. In order to use the normal XY Grpah, you would have two shif registers. One for the X array and one for the Y. Bundle the two arrays and then wire to the graph.

The other way is to use the Express XY Graph. With that, you can just wire your scalars to the X and Y inputs and set the Reset input to false.



Message Edited by Dennis Knutson on 11-12-2007 06:32 PM
Member
tlicquia
Posts: 4
0 Kudos

Re: How do I make an XY-Graph plot points over time?

I have tried before to just bundle the two samples and wire that directly to the XY-Graph as the help menu shows.  However, when I do so, the wire becomes dotted and a message appears telling me "the XY-Graph function requires 1-D array of a cluster of two elements".  I solved this problem by placing the 'build array' function between the 'bundle' and the 'XY-Graph'.  I am wondering if maybe I should be using a 'XY-Chart' as opposed to the 'XY-Graph' in order to plot multiple points?
Knight of NI
Dennis_Knutson
Posts: 31,961
0 Kudos

Re: How do I make an XY-Graph plot points over time?

The help does not show bundling the two samples and wiring it to the graph. The help shows exactly what is above. Two arrays bundled together. There is no such indicator as an XY chart. There is a shipping example called XY Chart in which you can make an XY grpah act like a chart. Use that example or one of the two techniques above. Have you tried either of the two I mentioned? If you have, what problems are you still having?

 

Member
tlicquia
Posts: 4
0 Kudos

Re: How do I make an XY-Graph plot points over time?

Unfortunately, I cannot work more on my program until tomorrow when I arrive back to my lab at the university.  I have previously attempted to do as you have explained before though.  My question now is how do I turn the sample output from each of my 'AI Sample Channel' functions into an array?  My guess is to wire the sample output to a 'build array' function, and then I can wire the output from there to the 'bundle' function?  Also, will this fix my problem with the graph not plotting multiple points?
Knight of NI
Dennis_Knutson
Posts: 31,961
0 Kudos

Re: How do I make an XY-Graph plot points over time?

If you have a single sample from the DAQ, do exactly like either of the examples I posted. The random number generator I used is to represent a single sample. You do not just wire it to the build array. That will just give you the same problem unless another end of the build array is wired to a shift register. The random number generator I used is to represent a single sample. You should post the code you have written so someone can actually see what you have and how it can be fixed.
Member
tlicquia
Posts: 4
0 Kudos

Re: How do I make an XY-Graph plot points over time?

Thank you very much for your help thus far.  I will try following you examples tomorrow.  Can you tell me where I can access the Express XY Graph?  Is that an insertable function or is it a pre-made example program?  Thanks again.
Knight of NI
Dennis_Knutson
Posts: 31,961

Re: How do I make an XY-Graph plot points over time?

Since LabVIEW 7, there is an Express XY Graph on the Grpah palette.
Member
nano3528
Posts: 23
0 Kudos

Re: How do I make an XY-Graph plot points over time?

Hello,

 

I carefully looked at what you posted about the XY Express graph and I got everything connected correctly, but the graph just shows a constant current for all voltage values.  I've attached the VI but won't have access to labview for about a week and a half after I post this. 

Knight of NI
Dennis_Knutson
Posts: 31,961
0 Kudos

Re: How do I make an XY-Graph plot points over time?

Before you leave, you might want to provide some information. Since your 'Voltage' data is a simple ramp function and can be verified without any hardware, create an another indicator for the string array output from the case statement. Then, run the VI and when it finishes, go to the Edit menu and select "Make Current Values Default". Save the Vi and post the saved VI. As it is, all of the indicators are blank and no one has any idea if you are even reading anything from the instrument.