LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reducing plots shown in legend causes error

I am using a waveform chart for a classic scope display, channel 0, channel 1 and math. Sometimes however I would like to set up the scope so the math channel is configured on the waveform, but not displayed, and not displayed in the legend either. It's easy enough to set it up to not be visible on the waveform, but making it not visible on the legend, either by reducing the number of plots shown, or by changing the legend height, so that in effect, the number of plots shown is reduced--either method makes later attempts to modify settings for the math channel cause an error (setting the active Y scale = 2 causes an error, since math is the 3rd scale, or 2nd w/ 0-based indexing).

Is there any way to make it not visible in the legend without causing an error for active scale or other properties I would like to set?
0 Kudos
Message 1 of 4
(2,724 Views)

@m3nth wrote:
either method makes later attempts to modify settings for the math channel cause an error (setting the active Y scale = 2 causes an error, since math is the 3rd scale, or 2nd w/ 0-based indexing).

Is there any way to make it not visible in the legend without causing an error for active scale or other properties I would like to set?




You made a confusion between scale and plot : Math is the second PLOT not SCALE. Scale refers to the Y axis. What you should have done is
1/ select the Active Plot ;
2/ make it Visible or not.
See the attached vi, a direct answer to your question.

However, this method is far from perfect : it works only if you need to show or hide the LAST plot of the series. If you hide an intermediate plot, the chart legend displays the hidden plot name, in front of an empty box. Moreover, the Autoscale property takes the hidden plot into account, not a desirable behavior.
A better, but more involved solution, would be to redraw the entire graph, choosing which plot to display. But there, you would have to manage the plot names, the colors, the point styles, etc...

May be NI, the world leader in graphic programming, could spend some more effort to improve its graphic tools... First getting rid of the major bugs ?

CC
Chilly Charly    (aka CC)
0 Kudos
Message 2 of 4
(2,713 Views)
First, I was confused in my statement on Scales versus Plots. You were correct in your reply, and I went back and looked at my code, which was actually using the Active Plot as you said it should have been, not Active Scale. I do use separate scales for each plot, hence my confusion, but that was not directly related to the problem I was having.

Second, your example was most helpful--thanks for posting that.

Third, after seeing that your example worked as desired, I tried to make it line up with my version of reality 🙂 It didn't, so I started to look into the differences.

- I am using a dynamic signal waveform graph instead of the kind you used.

- I rewrote your example with a cut and paste of the waveform graph I was using. The property nodes had to then be re-selected properly since the names didn't correspond on a 1 to 1 basis changing over to the dynamic signal graph (for instance Plot.PlotName -> Plot.Name)

- After some hair pulling, I tracked down the errors I was having and was able to reproduce them in simplified form using your example.


As it turns out, the root cause of the errors I was having is not having data displayed. I was trying to set up the graph and plots, colors, names, etc... before writing data. As you can see from the modified example, that doesn't work real well, unless you write an almost null array (1 set of zeroes) to the indicator. A lot of the confusion came from getting errors sometimes when trying to set the Active Plot, and not getting them other times--no reproduceability.

In the attached example, you can see that by setting math visible in the plot legend, you can modify the name and color, but then setting it invisible then visible again erases all the settings for that plot, so long as no data is displayed on the graph for it. With no data, and no visibility in the legend, trying to modify the active plot settings results in errors. I'm not sure whether this is a 'bug' or a memory management feature of dynamic waveforms, but it has definitely caused me quite a few headaches in the last few days. I think the short of it will be to initialize with a set of zeroes and that should take care of things. Thanks again for posting your example.
0 Kudos
Message 3 of 4
(2,697 Views)
Good catch.
I think there is something wrong here. Potentially a novel bug. Need some time to have a deeper look. Graphs are definitively a good place for bug hunting.
Some work arounds :
1/ wire an error out to the property node, or disable the "automatic error handling dialog" LV option in the prefs. That will avoid troublesome messages.
2/ use "NaN" Not-a-Number values instead of zeroes to pass dumb data to the graph (just type "NaN" in the control/co,stant instead of a numeric value. This will avoid plotting zeros...

CC
Chilly Charly    (aka CC)
0 Kudos
Message 4 of 4
(2,693 Views)