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: 

Is it possible to create a class or something combining 3 controls together?

Solved!
Go to solution

Ok. Let's make things simple.

I need to take data from about 10 groups ( totally about 80 sensors), store the data and

display the data on the screen. Since I have 10 groups, I want to show the data using 10 graphs. Sometimes, I want to see data vs time (that is, on the graph, there are multiple curves, each curve represents one set of data from one sensor, as shown in the waveform graph in the attached test code). Sometimes, I want to see the average values of the sensors over a time period (say, 1 sec) vs positions of sensors ( as shown in the bar graph in the attached test code). 

 

I could do the job by hiding/showing the XY graph and the waveform graph. However, I don't like the way it is done. Basically, there are two reasons:

First, since I have about 10 groups of sensors, I need to repeatedly position and resize the graphs many times, and make sure XY graphs are at the same positions/the same sizes as the corresponding waveform graph. It's time-consuming, and boring. Plus, in the diagram-panel, I have to repeatedly place the same subVIs, wires. And if I make any modification, I have to redo it 10 times. This isn't lot of fun, and can easily cause problems.

Second, each XY graph/waveform graph consume system resources. If I can use just one graph to show waveform/bar graph, the code is more efficient.

 

Any suggestion?

 


wiebe@CARYA wrote:

@blueJack wrote:

 

I never used labview classes, so I have no clue how a labview class integrates a front panel object into it. I tried to use 'find example' in the menu, but didn't find anything. You have any suggestion?


Building UI's with classes is particularly hard. Maybe not the best to start with if you'd ask me. Not because OO is not suited, but because in general UI's are not easy.

 

The problem is that usually when the classes are hierarchical, the UI is too. This is difficult to separate though, with updating values, catching events, and storing values all asking for (different) solutions.

 

If each class has it's own dialog, it's simple. Make the dialogs, and give each class a method that returns a reference to the dialog. Give the parent a method that run's the reference by reference (call by reference or call and collect\forget).

 

You can apply the same principle for hierarchies. The child shows it's panel with a subpanel. It calls it's parent method that inserts itself in the subpanel. The parent UI has a subpanel, and calls it's parent to insert it's UI... The Open and Close should also always call their parent methods, so the entire hierarchy get's opened and closed properly.

 

Note that the only way to do it without classes, would probably result in some kind of fake-OO idea anyway.

 

You can always use classes to do as much as you can, and put the UI's in non-OO VI's.

 

We might be able to make a small example (of a sub problem you're facing). But you'll have to give a very concrete and precise description. The entire scope of the problem will probably be too much work.


 

0 Kudos
Message 11 of 19
(1,104 Views)

Apart from a full architecture (I'm time restrained right now), one think can be done immediately to simplify the problem.

 

Why do you need the waveform graph at all? I never used them because the never do exactly what I want them to do. The waveform data can easily be transformed to XY data. That would simplify things a lot.

0 Kudos
Message 12 of 19
(1,093 Views)

I did think of extract time info from the waveforms and make it the data for X value, so I can plot them on XY graph. The problems, the waveforms makes an array of 1d clusters, with each cluster contains two 1d arrays. While for the bar graph, the input is an array of 1d clusters, with each cluster contains two elements. The data types are different. I can't wire the two to the same XY graph. Do you know any way I can programmatically change the input data type of XY graph?

 


wiebe@CARYA wrote:

Apart from a full architecture (I'm time restrained right now), one think can be done immediately to simplify the problem.

 

Why do you need the waveform graph at all? I never used them because the never do exactly what I want them to do. The waveform data can easily be transformed to XY data. That would simplify things a lot.


 

0 Kudos
Message 13 of 19
(1,081 Views)

You can't change the data type of an XY graph (while running, programmatically is possible when the VI is not running).

 

But you can change the data from the waveform graph, right? Array of clusters to cluster of arrays isn't that hard...

 

The underlying problem is you use waveforms. They're supposed to make things easier, but if you'd ask me they make easy things easy and hard stuff impossible. I'd make all data plain 1D arrays, including the time. That way, it's all transparent and much easier to handle.

 

 

0 Kudos
Message 14 of 19
(1,070 Views)

This sounds like a job for Tab Controls! Show/hide automatically and easy to work on just the active page.

TabControl.PNG

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 15 of 19
(1,067 Views)
Solution
Accepted by topic author blueJack

Oh, Yeah! The bar graph data can be a 1d array of cluster with just one element, and the element can be a cluster of two 1d array. I didn't realize that. Thanks!

 

Now I can use just one graph to plot either bar graph or waveform graph.

 


wiebe@CARYA wrote:

You can't change the data type of an XY graph (while running, programmatically is possible when the VI is not running).

 

But you can change the data from the waveform graph, right? Array of clusters to cluster of arrays isn't that hard...

 

The underlying problem is you use waveforms. They're supposed to make things easier, but if you'd ask me they make easy things easy and hard stuff impossible. I'd make all data plain 1D arrays, including the time. That way, it's all transparent and much easier to handle.

 

 


 

0 Kudos
Message 16 of 19
(1,058 Views)
  • You only need to set the properties when the switch changes, not with every iteration of the loop. Property nodes are relatively expensive.
  • Since all your x-scales are spaced equally, all you need is a waveform graph. No need for xy graphs.
  • You can set dx with a property node.
  • ...
0 Kudos
Message 17 of 19
(1,041 Views)

Here's what I had in mind .... No XY graph needed.

 

(Note that you can make the bars have different colors if you do it right)

 

SwitchPlotStyle.png

Message 18 of 19
(1,035 Views)

Thanks. I knew changing values of property nodes must consume some system sources. But I don't know how much. I totally agree that the property nodes needs to be reset only when the display mode is switched.

 

 


@altenbach wrote:

Here's what I had in mind .... No XY graph needed.

 

(Note that you can make the bars have different colors if you do it right)

 

SwitchPlotStyle.png


 

0 Kudos
Message 19 of 19
(1,017 Views)