LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I make an adaptive Y axis on a waveform graph?

Solved!
Go to solution

Hi all.

I am plotting very small relative pressure changes on a waveform graph and want a fixed range Y axis (say plus or minus 50). However, the measurements are affected by atmospheric pressure so the absolute level changes from day to day, one day it could be that the axis needs to be 100 to 200, the next day it might be 600 to 700.

In this example, I don't want an axis that goes from 0 to 800, you wouldn't see the small relative measurements. Nor do I want an autoscaling Y axis that jumps about and fills the screen with signal.

What I would like to do is to adapt the scale so that it is, say, 50 above and 50 below the mean of the signal over a short period. The operator could adjust the scale manually but I would like to do it programmatically.

I have tried to simulate the sort of signal in the enclosed vi. The actual code needs the hardware to produce anything.

Thanks for any help.

Andrew

0 Kudos
Message 1 of 7
(2,974 Views)
Solution
Accepted by topic author ASH2020

Hi Ash,

 

50 above and 50 below the mean of the signal over a short period

Determine the needed range programmatically (as you already seem to know the required algorithm) and set the Y axis min/max using property nodes!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(2,957 Views)

Thanks for that. I don't know why I didn't think of it. I've tried it and it works nicely, by averaging the dataset that I'm plotting. I just want to set the scale when the vi is run for the first time but it is adapting with each dataset coming in. I suppose I could set a one time flag and put the bit of code in a case loop?

0 Kudos
Message 3 of 7
(2,942 Views)

Hi Ash,

 

LabVIEW has a FirstCall function…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(2,938 Views)

@ASH2020 wrote:

I suppose I could set a one time flag and put the bit of code in a case loop?


You might want to add a button to rescale the axis on demand as well.  So it would be First Call? OR Rescale to do the analysis and set the scale.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 7
(2,920 Views)

@crossrulz wrote:

@ASH2020 wrote:

I suppose I could set a one time flag and put the bit of code in a case loop?


You might want to add a button to rescale the axis on demand as well.  So it would be First Call? OR Rescale to do the analysis and set the scale.


That's a great idea. I will do a button. Thanks.

 

0 Kudos
Message 6 of 7
(2,909 Views)

@GerdW wrote:

Hi Ash,

 

LabVIEW has a FirstCall function…


I didn't realise that. Perfect for this issue. Thanks.

0 Kudos
Message 7 of 7
(2,906 Views)