06-08-2010 10:22 AM
Hello everybody,
I have a question about the programming of a waveform's legend. I already asked here in this forum about the legend programming (03) months ago.
I went satisfied but I ve just noticed that this code
(See Code old_legend_test.llb with main.vi as main function) operates a
little different from my expectances.
Therefore I have a new question and I want to know if it is possible by labview programming to plot and show, on a waveform chart, a signal with activ plot superior to zero (0) without to be obliged to plot and show a signal with activ plot equal to zero (0) or inferior to the desired activ plot.
I give you an example of what I m meaning. I have by example 4 signals (Signal 0, 1, 2 and 3) and each signal corresponds respectively to a channel (Chan1, Chan2, Chan3, Chan4). I want to control the legend (activ plot, plot name and plot color) programmatically. Is it possible with labview to plot signal 1 or 2 or 3 or (1, 3) or (2,3) or (1,2,3) or other possible combination without to active the signal with the corresponding activ plot zero (0)?
Let see the labview attached data (new_legend_test.llb with main.vi as main function). When I try to control the input selected values again I get them back but I don't understand why they have no effect on the legend of my waveform chart. Could somebody explain me what I m doing wrong or show me how to get a correct legend with desired plots? Thank by advance for your assistance.
N.B.
The both attached data are saved with labview 2009.
Sincerly,
PrinceJack06-08-2010 01:00 PM
Try using the loop index to set the "active plot" number.
06-08-2010 04:46 PM
I thank you for your answer but what you are suggesting is what I already have with the attached labview code: the old_legend_test.llb
It is important not to forget that the Channel 1, Channel 2, Channel 3, Channel 4 must correspond respectively to the active plot 0, 1, 2, 3.
06-09-2010 07:39 AM
Hi princejack,
Thanks for posting on National Instruments forum.
The behavior you have is completely normal. You can control the number of row displayed in the legend and this rows are linked to the data you send to your graph. Thus, if you have 3 arrays of data, let say chan1, chan2 and chan3, you can choose which data you want to display in your graph using the property node (Active plot and visible). But for the legend as you send 3 plots there is an array of the plot name [chan1, chan2, chan3] and you can display 0, 1, 2 or 3 rows of this array but you cannot control the order in this array! So, to be able to change this array you have to only send data you need to you graph. I'm not sure my explanations are clear so I have implemented a simple example doing that.
06-09-2010 12:09 PM
Thank you BenjaminR for your answer.
I had already seen this example that you send bevor to write on this forum. This example didn't help me because the plot.name and the plot.color are sent to the legend through the configuration of each generated signal and not programmatically.
In my programm it is important to send the active plot, the name and the color of each signal to its legend.
I ve also tried to write a code (new_legend_test2.llb) like this one but I ve noticed that the legend don't run normally when I send programmatically the active plot, the plot.name and the plot.color to the legend. see the attached bild : Frontpanel_new_legend_test2.jpg.
why are the control values correct and these values are not sent to the legend ?
must I understand that it is not possible with Labview to send programmatically defined data to the legend?
06-09-2010 01:50 PM
Hi Prince Jack
I think BenjaminR example was good you just have to take the next step and change the color of the plot.
I've attached another example that takes that step.
Hope it helps.
Eric
06-29-2010 06:48 PM
Hello Arvin!
I m sorry for my late answer. I ve found your example really interesting. It was almost what I was looking for.
I ve tried to apply your example to my project but it didn't operate like I ve hoped it.
As I ve tried to read the signal from my device and to select the channels, I was happy to see the plotting of selected channels with corresponding legends. But I ve noticed that it is not possible with this solution to hide and show the signals after the data acquisition. And another problem was the cleaning of the plot's history each time when I m selecting a new channel.
I ve tried a lot of possibilities for a long time. Therefore I didn t answer immediately. I ve tried a lot of possibilities but I didn't find the right solution. I ve decided then to plot the selected signals without to display their legend. You can see my attached example. The device is a NI 6211. You test with other NI DAQ devices. You ve to change the name of the device and specify the rigth channels and other initial values if necessary.
But I want to thank you very much for your solution. It was a great solution, if even it has not well operated with the project.
Thank again and I wish you all the best.
Sincerly
06-30-2010 06:09 PM
Hi
I'm glad you found a solution. I wanted to let you know that it would be possible to hide a plot and then recall the data. You would have to use a waveform graph instead of a waveform chart and you would have to build your own buffer for the data in your loop using a shift register. You would then index the channels you want from the buffer and display them on a graph but the buffer would still hold all your data for recall.
Most of the stuff I do if for internal use only so I don't spend a lot of time trying to make my graphs look pretty, but if you would like an example I'll see what I can do.
07-01-2010 12:45 AM
Hi Arvin,
Thank you for your feedback. I will be happy to get your example if it you have some time. I thank you for your great aid and wish you all the best.
Sincerly,
PrinceJack
07-01-2010 12:14 PM
Hi,
I had a few minutes this morning and put an example together.
Keep in mind that you would to group some of these functions into Sub VI's and keep your BD clean, but the example illistrates my point. You can keep all your data in a buffer and call it on your display when you need it.
You may even consider building your buffer in an action engine:
Another consideration would be to use a producer consumer architecture if the display starts slowing your DAQ down.
Hope this helps.