03-26-2017 02:30 AM
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.
03-26-2017 08:49 AM
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.
03-26-2017 10:38 AM - edited 03-26-2017 11:01 AM
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)
03-26-2017 04:46 PM
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.
03-26-2017 05:02 PM
(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.
03-26-2017 05:18 PM
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.
03-26-2017 08:21 PM - edited 03-26-2017 08:21 PM
@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.
03-26-2017 08:46 PM - edited 03-26-2017 08:47 PM
@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.
03-26-2017 10:26 PM - edited 03-26-2017 10:37 PM
Thanks again.
Is it possible to the plotting without storing the values in an array or something similar? Because I need it graph forever.
03-27-2017 06:45 AM
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.