Showing results for 
Search instead for 
Did you mean: 

Flexible assignment of variables to xy graphs

Please let me know if this can be done and how to do this in a Labview vi. 

I have n xy graphs. In a while loop during each iteration I can generate m (time,value) pairs, m <= n. Before starting the execution of the while loop, I would like to define the destination for each pair of data, for example, send (pair i) to graph j as plot k. A graph can have more than 1 plot. 

Thank you. 


0 Kudos
Message 1 of 9

Yes, that's easily possible. what have you tried?


XY graphs take many datatypes (complex arrays, array of posts, cluster of x and y arrays, etc.), so it would be important to see how you are doing things. Please attach your code.

0 Kudos
Message 2 of 9

I have not tried anything yet. Only have some ideas. I will define n graphs, m (x,y) clusters and m toggles to turn on the desired number of total plots. In the while loop I will create a pair of time,value pair for each active plot. I do not know how to define the mapping, but I will have to pass an array of pair references in the order of plots to a graph. Does this make sense? 


0 Kudos
Message 3 of 9

First of all, the number of graphs is defined at edit time, but you can of course hide some if you don't need them.

Since you did not even attach a code draft (e.g. containing the desired front panel elements so we get a better idea!), let's first make sure we agree on the meaning of the terms:


Graph: An xy graph placed from the palette on the front panel. Each graph can have an unlimited number of plots.

Plot: A set of xy points on a graph, having color and cosmetics defined as in the palette)

Pair reference: I have no idea what that is! Please explain!

Variables: What are variables?


How many graphs? How many plots per graph? Is the time increment constant or variable? If the points are regularly spaced, you don't even need an xy graph! How should the "mapping" control look like?

0 Kudos
Message 4 of 9

The skeleton of the vi is attached.

I do want to plot points as they are generated, not xy graph at the end.

What I mean by mapping is given in the array in tab 1. Of course this is a test example. In the final application the user should be able to change the mapping as desired based on the type of data generated. 

Even though in the test, the points will be at regular interval, I would like to use xy graph because in the final application they will typically be not at regular interval.

What I don't know is how to implement the mapping and sent the data to the specified plot.

Hope this clarifies your questions. 


0 Kudos
Message 5 of 9

Thanks. I'll study it later in more details.


So you have four data sources and four plots. Shouldn't the matrix be size 4x4 instead of 3x4? What is the meaning of a row or column (graph? Plot?) What are you planning as string syntax? Wouldn't a 4x4 2D array of booleans be sufficient?


  • Why is the matrix terminal inside the loop if you want to set the mapping only before the start?
  • Why are the graph terminals outside the loop if you want to update them regularly?
  • Why is there a sequence structure? Seems pointless.
  • Your graph and time data belongs in shift registers, no bounced around using local variables.
  • The output of the ticker is a random U32 number and incrementing your "t" with it makes absolutely no sense.
  • You data is spaced equally in time, so you don't need an xy graph at all. plain waveform graph will be much easier to handle. You can set dt of the x axis as needed.
  • What is the point of the four stream controls if the user should not really interact with them? Just scaffolding for a local variable?
0 Kudos
Message 6 of 9

As I had said this is just a test case to conceptually show what I would like to do. The graph terminals are outside because I do not know how to send the pairs of data to the right graph based on the mapping. The matrix is inside by mistake as the test example is not fully functional yet. Yes, the time will be properly incremented. 

In the final version, the data will come from instruments in real time and plotted on graphs. But conceptually, based on specific instruments in use, the data will be plotted on user specified graphs.

Thank you. 


0 Kudos
Message 7 of 9

I still don't understand your switching matrix. Can some data be shown on more than one graph?

0 Kudos
Message 8 of 9

One data stream can be shown only on one graph. The 'switch matrix' defines the groupings of variables by graph. Of course, the user can change the grouping before execution begins, thereby changing what is displayed on each graph. So, for a given run, the groupings stay fixed.


0 Kudos
Message 9 of 9