LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Having a problem with using XY Graph

Hello,

 

 

I have been trying to use XY graph, but I failed to do so.

The problem is that the source and the sink  have different types. The source is a cluster of two elements, and the sink is 1D array  of cluster  of two elements. I don't how to convert the source to a 1D array of cluster of two elements. I have  used several clusters, arrays and even bundles to make XY graph work, but nothing worked.

 

 

 

I hope that I get some guidance of how to solve this problem.

 

 

Thanks a lot.

0 Kudos
Message 1 of 12
(3,781 Views)

You can use LabVIEW context help (ctrl+H or the question mark button in the toolbar) to see what should be connected to the different type of graph. With the context help open, just hover your cursor on the terminal (see image below).

In the case of a XY graph, you must provide a cluster made of two 1D arrays of the same size, one for X and one for Y. You can have more than one plot by putting more than one of those clusters in another cluster. 

In the image you sent, you put only single values in a cluster. You must create arrays of your values before being able to plot them in a XY graph.

 

graphhelp.png

Marc Dubois
0 Kudos
Message 2 of 12
(3,737 Views)

An xy graph accepts much more than mentioned above (e.g. complex arrays). In your case, you could insert a "built array" after the "bundle", creating an array with a single element and you'll always see the latest acquired point, nothing else (also make sure to select a plot with visible points, not just lines. Line are not visible if there is only one point).

In the more typical scenario, you want to show ALL or at least the last N points, so you would accumulate the data in a shift register. There are plenty of examples in the forum. Did you do a search?

Another option would be to use the "build xy graph express VI". (i.e. what you get when insrting the xy graph from the express palette) You can configure it to "retain data between calls", and it accepts scalars, acting more like an xy chart.

 

 

(Also, if you would attach your actual VI instead of a picture, we could show you the various solutions directly)

0 Kudos
Message 3 of 12
(3,728 Views)

Thanks a lot of your response.

 

What I am trying to do is get values from the 2 analog pins ( Let's name them A0 and A1) in the Arduino, then make a graph of the values read from the Arduino in Labview. So I need to make something similar to table that has two columns, one for A0 and the second column is for A1. Then Plotting an XY graph.

 

What is the best thing to do such thing?

 

 

Thanks again.

Download All
0 Kudos
Message 4 of 12
(3,694 Views)

(posting by phone, cannot look at your code)

 

There is no need to attach a lvproj file, it does not contain any code. Yes, you need to build your array in a shift register. Easiest would be 1d complex, which can be wired directly to the xy graph terminal.

If you know the final number of points, you could use a FOR loop and an auto-indexing output tunnel and graph everything at the end at once.

0 Kudos
Message 5 of 12
(3,689 Views)

 

There is going to be no limit for the number of points.  

 

I'm really sorry. I am new to labview. What do you mean with 1d complex?

 

Thanks.

0 Kudos
Message 6 of 12
(3,684 Views)

@haalshaikh wrote:

What do you mean with 1d complex?


Use the Real/Imaginary To Complex to make a complex number.  When wired to the graph, the real part will be the X coordinate and the imaginary will be the Y coordinate.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 12
(3,664 Views)

@haalshaikh wrote:

 

What is the best thing to do such thing?

 


None of what you attached has anything to do with the xy graph problem.

 

Yes, there is a limit for the number of points. They are imposed by the OS and the available memory. Nothing is unlimited.

 

In any case, here's one simple way to do this. Maybe you can use it as a skeleton for your code. Still, you probably should first start with a few simple LabVIEW tutorials.

 

Download All
0 Kudos
Message 8 of 12
(3,653 Views)

Thanks again.

 

Is it possible to the plotting without storing the values in an array or something similar? Because I need it graph forever.

 

0 Kudos
Message 9 of 12
(3,635 Views)

haalshaikh wrote:

Is it possible to the plotting without storing the values in an array or something similar? Because I need it graph forever.


The data has to be stored somewhere.  Do you really need to plot every single point or would only the last 1k samples be fine?  You can easily manage that with a Complex Queue PtByPt VI.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 10 of 12
(3,614 Views)