From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

Y-scale fit on waveform graph doesn't scale

Hi experts,

 

I've a problem with the YScale.ScaleFit property of WaveformGraphs. My VI is attached.

 

The idea is using a checkbox (Full Range) on the GUI front panel to control Y-axis Autoscale. When the checkbox is off, autoscale is disabled and custom scale values are set. When the checkbox is on, autoscale is re-enabled. This is where the VI doesn't work: autoscale is re-enabled only for some of the graphs in the GUI. The VI gets the references of these graphs as an array of strict references. I tried to force a redraw but it doesn't help at all. Interestingly, the drop down menu that I get by right clicking on the graph, has the correct Autoscale setting! So I don't see why soem graphs get stucked...

 

I'm using LV2010 on Windows 7.

 

Thanks,

Dan

0 Kudos
Message 1 of 8
(3,613 Views)

Update: I noticed that, after YScale.ScaleFit has been set to 2, I can "unfreeze" the graph just by manually changing a value on the Y scale.

 

So, I modified my code like this: before setting YScale.ScaleFit to 2 I put another property node, that sets Y.Maximum to 2 (could be any other number). This way the code works, but that's weird. Why does the graph gets stuck and needs a kick to get back to normality?

0 Kudos
Message 2 of 8
(3,602 Views)

Hello dany1,

 

I am not pretty sure I understand your question. As you can see in the help context, by choosing between values 0,1,2 as inputs in the property node , you achieve 3 different things.

 

0 is for Do not Autoscale

1 is for Autoscale once

2 is for Autoscale

 

This means that when you give 2 as an input in the property node, the scaling will change automatically depending on the amplitude. If 0, the scaling will remain the same.

In the attached file I changed a bit your .vi. It works fine I think.

 

   
   
   
Antonios
0 Kudos
Message 3 of 8
(3,576 Views)

Antonios,

 

thanks for your response and the attached file. I red the help context before posting, and it was pretty clear. Unfortunately, the function works only with the workaround that I explained. I tried to turn the workaround off, and the previous behavior re-appeared.

 

When I disable autoscale, I change the Y-Scale values right away. Could it be that this operation prevents in some way the re-activation of autoscaling?

 

The thing that puzzles me most, is that the problem happens only for some of the 16 graphs I have on the FP! Considering I use a For Loop, and the code it's always the same, I see no reason for this.

 

Best,

Dan

0 Kudos
Message 4 of 8
(3,573 Views)

Can you attach a full demo code that shows the problem? How are you calling this subVI? Why are you closing the references?

0 Kudos
Message 5 of 8
(3,567 Views)

In the code you supplied the array you used to set the Y scale is empty. The for loop will not execute, you must have as many values in this array as you have in your reference array. If your code only works for some of the graphs but not all it suggests that the sizes of the two arrays don't match.

 

Ian

0 Kudos
Message 6 of 8
(3,557 Views)

Hi Ian,

 

the array is actually made of 16 global variables (I should change that I know). So the size is not a problem: I checked that the loop runs for 16 iterations.

 

Altenbach: I'll try to reproduce the thing and post it.

0 Kudos
Message 7 of 8
(3,548 Views)

Hi everybody,

 

I have an update, though I haven't been able to put together a demo that shows the problem.

 

I generated an array that collects all the event types that occur during execution of my sub-VI. I found that, when I zoom into the graph, the Scale Range Change Event gets triggered twice (in a row). When I autoscale the plot, I get 2 Autoscale Range Change Events and then 2 Scale Range Change Event. This way, autoscale is disabled again, immediately. I'm adding a workaround to avoid this.

 

What is the reason for this? Maybe I get one event for Y.Maximum change and one for Y.Minimum change?

0 Kudos
Message 8 of 8
(3,500 Views)