LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Setting Min and Max Autoscale for chart?

Solved!
Go to solution

I'm wondering if there's a way to to have the Y data be scaled to be +-200 what the input value is? For example if the RPM is 1500 the scale would show range 1300 to 1700, then as the RPM changes is changing those max and mins on the scale. Input is a 1d array with analog waveform. The image attached is me playing with the autoscale delay property node, but if the value is steady for a period of time it will still change the scale to +-1 on the view which isn't ideal. I know you can manipulate to get the min and max with the history property node, if that's the answer then how do you cap it to only pull the history of what I'm displaying to avoid constantly messing with a massive array. Let me know you thoughts. Thank you.

0 Kudos
Message 1 of 6
(2,123 Views)

Hi breezy,

 


@breezy45 wrote:

I'm wondering if there's a way to to have the Y data be scaled to be +-200 what the input value is?

I know you can manipulate to get the min and max with the history property node,


So you already know how to set Y scale min/max using property nodes? Then you're finished atleast halfway…

 


@breezy45 wrote:

if that's the answer then how do you cap it to only pull the history of what I'm displaying to avoid constantly messing with a massive array.


Use the PtByPt-MinMax function with a history length the same as your charts' history length to determine the min/max of the last number of samples. No need to read the chart history again and again just to get the array of samples…

 

(On the other hand: when you need to keep an array of sample to determine min/max data you can also use a graph instead of a chart and handle that array completely in your code!)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 6
(2,115 Views)

What I think you are asking for is Programmatic Management of the Y Scale.  This is certainly doable -- as the data come in, you keep track of the Max and the Min (including where they are in your data stream), and make decisions on changing the Max and Min of the Chart "on the fly" as necessary.  When a Max or Min point goes "off-screen" (because of scrolling), you would calculate a new Max or Min from the current "on-screen" points (or not, depending on how you want the Chart to behave).

 

Another algorithm you might consider is the following:  as before, keep track of Max and Min and allow it (as required) to expand the Scale.  Note that this keep the Scale "growing" so that you can see the "Highest" and "Lowest" points.  But what happens if there is a "Noise Spike"?  Well, you see it, and then it scrolls off-screen.  If you've been recording its X position (as well as Y), you'll know when that happens, and can decide to "readjust" the Scale.  AutoScale, I think, uses the existing data and zooms down "as far as it can" (perhaps only to zoom back up).  You, on the other hand, can choose to, say, zoom down by a factor of 2. or zoom keeping the mean in the same place, or whatever makes the best sense to you.

 

Bob Schor

Message 3 of 6
(2,114 Views)

The property nodes you are looking for are:

  1. Active Y Scale (If you have more than one you must select the one you want first)
  2. YScale
    1. Range
      1. Min
      2. Max
  3. YScale
    1. ScaleFit

Y scale range is self explanatory

The Scale Fit property turns auto scale on, off, or scale once

 

========================
=== Engineer Ambiguously ===
========================
Message 4 of 6
(2,103 Views)
Solution
Accepted by topic author breezy45

Taking everyone's input into account a solution was made, essentially all three responses were correct and lead to a solution. It's a bit more complicated than mentioned before because it needs to scale differently depending on which direction(so positive RPM and negative RPM). Thank you for the input.

0 Kudos
Message 5 of 6
(1,994 Views)

Hello,

 

I actually found a solution for limiting the autoscaler that is simple and intuitive: You just have to add one or two "invisible" plot traces, which describe the desired max (and min) Y-range of the chart.

 

The key is to keep the "Visible" property set to TRUE, otherwise the autoscaling will ignore the trace. So we need to make the trace invisible by other means, namely by giving it a "no dot marker" and "no line" property as follows:

 

 

How to add an invisible plot trace, which is still visible to the autoscalerHow to add an invisible plot trace, which is still visible to the autoscaler

 

This works like a charm, I can now calculate my own scaling limit continuously and keep writing it to the boundary trace (Plot # 99 in this case) as needed. As far as I can tell, there are no visible artifacts from the presence of this additional invisible trace. 

 

If I wanted to reset that limit (i.e. lower it), I would perhaps set that boundary marker trace to "invisible", and/or start a different boundary marker to take over the boundary marking duty.

Message 6 of 6
(1,876 Views)