09-02-2022 11:05 PM
Hi, I am using the waveform chart of LabVIEW, but I have a problem. Is there a way to generate the corresponding number of waveform charts at run time based on the input value of an input control? Or to put it another way, can you configure the variables displayed in the waveform chart at run time? Thank you very much for providing me with some ideas.
Solved! Go to Solution.
09-03-2022 04:37 AM
@SliverAsh wrote:
Hi, I am using the waveform chart of LabVIEW, but I have a problem. Is there a way to generate the corresponding number of waveform charts at run time based on the input value of an input control? Or to put it another way, can you configure the variables displayed in the waveform chart at run time? Thank you very much for providing me with some ideas.
Your description was a bit vague, but you can configure individual plots on the chart. Do you need each plot in its own chart, or can you have them all in one?
09-03-2022 06:22 AM
I'm sorry if my description is not clear. A detailed description of the problem is as follows:
I have placed several waveform charts on the interface, and I hope that my users can control the variables displayed in these waveform charts by inputting variable names in the front panel,instead of going to the block diagram interface every time to make the waveform chart show the waveform of corresponding variables by programming. For example, my hardware has obtained six variables A, B, C, D, E and F through sampling. I hope my user can input A in one input control on the front panel, let waveform chart 1 show the waveform of variable A, and input C, E in another input control. Let the waveform chart show the values of two variables C and E (or any number of other variables). I considered using clusters to package all variables and connect them to the waveform chart and then select variables by legend, but this method is too CPU intensive and not convenient for my users. Could you give me some other ideas?
09-03-2022 11:08 AM
If your users were all expert LabVIEW Programmers, you could give them the code and say "OK, make the Plots that you want/need in the style that you would like to see them". But that is rarely the case!
So some decisions need to be made. Here are some of them:
Let's say you have 6 signals of moderate frequencies. Just for the sake of illustration, I'm going to assume you sample at 100 Hz and want to see the most recent 6 seconds of results, meaning you need a chart of 600 points (it might look "nicer" if you make it 601). You can:
You can also "mix and match". If you have a 6-signal Chart, you can add a Boolean control to each signal to turn plotting On or Off, so the User can choose to look at only Channel 3, or Channels 1 and 5, or all Channels.
Alternatively, you can write six sub-VIs, one for each Channel, and pass each sub-VI one channel's worth of data. If you don't actually view the data, this is not a big strain on the processor. Now what you do is create a sub-Panel on your main VI, and, at Run Time, decide which of the six Channel's "Show Me the Chart" VIs you want to display.
More "customization", of course, means more skill required by you, the LabVIEW Developer. The tools are largely there, you just need to learn how to use them.
Bob Schor
09-03-2022 12:56 PM - edited 09-04-2022 01:08 AM
The number of plots on a waveform chart is determined by the data wired to it. A chart accepts a large variety of datatypes, and most support a variable number of plots that can change at runtime. (The only exception is a cluster, which is of fixed size).
charts accept:
If this does not get you started, you need to attach your VI so we can see what you have (simplify it to the essentials and substitute simulated data if necessary). Too many possibilities to give a generic solution that fits all scenarios.
To let the user choose at runtime what to plot and where, "herding cats" comes to mind. Do all charts update at the same frequency? What should happen to the history data if the users swaps plots between different charts at runtime? etc. etc. If all charts update synchronously, the simplest would be to keep a 2D array of data in a shift register and, for all possible inputs, replace the oldest with the newest with each iteration. create a switch matrix to reassemble the various rows to the various graphs for display (i.e. no longer use a chart because you keep an explicit history!). Whenever the selection changes, you can update all legends and axes using property nodes. The x-axis is shared by all graphs and you should decide what to show.
09-03-2022 10:18 PM
09-03-2022 10:20 PM
Thank you very much for your patience
09-05-2022 06:30 AM
Hi,altenbach.
I tried to do an experiment, I have my VI and application screenshots packaged upload share
The general idea of the program is as follows: my lower computer would arrange the collected variable parameters and send them to the upper computer through Ethernet. In the simplified VI I uploaded, I used a for loop and output the number of loops to form an increasing array to replace the collected variable data. I tell the waveform chart which variables I want to observe by typing a comma delimited string before the program runs. Note that I set the cluster size to 5, as it is not common to display more than 5 variables on a single waveform chart. Considering that when the number of variables displayed is less than 5, the curve with a value of 0 will be displayed in the waveform chart, I added a Boolean array to remove the excess curve.
welcome to make some valuable changes to my program~
09-05-2022 08:26 AM
Sorry, I don't have access to LabVIEW 2021 at the moment. Can you "save for previous" and attach it once more. Make sure the string control contains typical default data.
(Just looking at your code, it is pure Rube Goldberg. You should not need any downhill sequence structure, and all these local variables. Way too many loops! Way too little autoindexing. You definitely need to spend a little more time on tutorials)
09-05-2022 09:04 AM - edited 09-05-2022 09:05 AM
Don't use a cluster if the number of plots can change!
See if this can give you some ideas. We simulate 10 data traces and pick the ones based on the selection string entered before the run.