LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically add curves to xy graph

Solved!
Go to solution

Hi,

I am taking a few measurements and want to display them all in one graph. Basically I want to use an xy-graph to display first only one curve (1st measurement) then two curves (1st+2nd) and so on. As I need to adjust some things for each measurement based on the previous one I cannot just display them altogether in the end.

Is there any way how to do this in labview?

Thanks in advance,

Florian

0 Kudos
Message 1 of 7
(4,964 Views)

You can display multiple plots (curves) in a XY Graph. Note that, unlike LabVIEW charts, the LabVIEW Graphs will not hold the data in its own memory. So its the programmer duty to hold the data in temporary buffer.

The data type for multiple plot XY graph is - Array of cluster (cluster contains Array of X points & corresponding Y points).

Also you can add more scales to XY graph

Regards,
Yogesh Redemptor
0 Kudos
Message 2 of 7
(4,957 Views)

Have you looked at the examples that ship with LabVIEW? There are examples on how to use charts and graphs which include how to display multiple plots. If you are dealing with an XY graph and you want it to work like a chart (i.e., data gets appended to it over time), then you can look at the "XY Chart" example, which uses a subVI as a buffer, as indicated in the previous post.

Message 3 of 7
(4,932 Views)

Thanks so far,

the problem for me is not to display multiple plots, it is more to add curves one after the other. I can't show a snipped of what I think but I'll try to explain in steps what I am trying to do:

 

1) I take the first measurement and display the data on a graph

2) I do some changes based on the first result

3) I take another measurement. Now I want to display 2 curves instead of one in the same graph as before

4) do some changes, another measurement

5) display all 3 curves in the graph

 

The problem is that if I create an array of the 3 curves it waits until the last measurement before the data is processed by the graph.

I use a flat sequence structure for the different steps and my solution so far is to add another graph after each step to display the curves (one curve in the first one, two in the second one and so on)

 

Is there any way how to do that?

Thanks a lot!

0 Kudos
Message 4 of 7
(4,919 Views)

You can try with '.net' graph/chart. Which have a feature to control over plot by command.

https://decibel.ni.com/content/docs/DOC-9946

 

Regards,

Yogesh Redemptor

 

 

Regards,
Yogesh Redemptor
0 Kudos
Message 5 of 7
(4,909 Views)

LV will not plot points that have the value "NaN" Not A Number. You can take advantage of that behaviour by using "NaN" values for the plots that you don't have data to fill in yet.

 

When you get to step 2 you use the real numbers insetead of NaN's. Lather, Rinse, Repeat.

 

Have fun,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 7
(4,904 Views)
Solution
Accepted by topic author Florian123

Thanks for your help guys,

the trick I was missing was to create local variables of the graph each time I change something. Also I first created an array of how many curves I want in the end and fill them up with copies of the first measurement and replace them successively.

Works without a hitch now 🙂

0 Kudos
Message 7 of 7
(4,882 Views)