From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Feeding different amount of plots to XY Graph using a local variable

Solved!
Go to solution

Hi there, 

 

I am writing a measurement software using LabView 2009 SP1. The program runs in a while loop and a number of data acquisition routines are accessible using a case structure. All of the measurement routines  should display the acquired data in a central XY Graph, which is located on the most outer structure of the program. 

Depending on the routines that is used we have one, two or three sets of data that have to be displayed simultaneously on the same XY Graph. 

 

The way I have realised this is with a XY Graph indicator in the outer shell of the program and a local variable of it in the respective cases in that I write the sets of data using 'build array'.

 

The problem now is that when the graph is initialised to 2 graphs I can only feed two sets of xy data to it and when initialised to 3 graphs only three sets of data... 

 

Is there a property I can modulate using a property node that can modulate the amount of data sets in a xy graph? 

 

To visualise the problem I attached a sample vi that shows my problem in the most simple case and screenshots of it.

xy_sample_app_0.PNG

xy_sample_app_1.PNG

 

best,

 

Julian

 

0 Kudos
Message 1 of 3
(2,667 Views)
Solution
Accepted by topic author jschmidtengler
  • Insert a "built array" of height 1 in case 0. Now it is always an array, with either one or two elements. You cannot mix datatypes on the same graph (scalar vs array)
  • Place the graph terminal after the case structure and remove both locals they are not needed.
  • Do not maximize the diagram and front panel to the screen. Very annoying.
  • Place a small wait in your loop. No need to burn 100% CPU spinning the loop as fast as the computer allows.

0 Kudos
Message 2 of 3
(2,660 Views)

I don't understand what you mean by sending 2 sets of data or 3 sets of data.

 

In your simple VI, it looks like you are sending either 1 plot or 2 plots.  You wind up with a wiring error because of the different data types.  In one case it is a cluster of X and Y arrays.  In the other it is an array of clusters of X and Y arrays.

 

Put a Build Array right after the bundle in default case 0.  Now your wire will no longer be broken in the other case.  You may need to wire it to the XY graph terminal first.  (Actually, I'm not sure why you are even using local variables here.)

0 Kudos
Message 3 of 3
(2,647 Views)