LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Waveform Graph Scale

I was wondering if for the "Waveform Graph" control there is a possibility that the scale is fixed to the maximum value of the signal detected throughout the execution, without the scale being reduced during the execution.

0 Kudos
Message 1 of 7
(1,081 Views)

Hi Jaime, 

something like the example attached would work for you? It is valid if you have only one Y Axis and one plot. 

"Overcome your challenges"

Adriana Oliva - DM Integrations
Download All
0 Kudos
Message 2 of 7
(1,067 Views)

@JaimePM wrote:

I was wondering if for the "Waveform Graph" control there is a possibility that the scale is fixed to the maximum value of the signal detected throughout the execution, without the scale being reduced during the execution.


To get aspecific answer, yuo need to be much more clear what you have and what you need. Charts accept a huge variety of data types (scalars, cluster of scalars, 1D arrays, 2D arrays, Waveform data, dynamic data, etc.) and hte solution will depend on it.

 

You are not saying anything about the "minimum". Should it be zero or adjusted to the smallest value found so far? Once you turn off autoscaling, you can set the range at any time using a property node, which only need to be done when the max or min changes, not with every update, of course (not shown).

 

 

In the simplest case, a chart gets one scalar point per update, so here's a solution for that:

 

altenbach_0-1647796235894.png

 

0 Kudos
Message 3 of 7
(1,040 Views)

First of all thanks for the reply,

 

Sorry for not explaining myself well, this is my first post.
What I am trying to represent is a signal in amplitude and time and I wanted the y-axis (amplitude) to be set to the maximum value of amplitude that is displayed for the signal throughout the execution in such a way that if later the amplitude decreases, the y-axis stays at that value but if the amplitude later exceeds the maximum value of the y-axis, the y-axis is updated to that value. Finally, since it is a sinusoidal signal, the minimum would behave in the same way as the maximum, being the same value but with opposite signs.

 

In brief is like an autoscale but the values only increase (both minimum and maximum).

0 Kudos
Message 4 of 7
(1,036 Views)

You are still not specifying the data type.

0 Kudos
Message 5 of 7
(1,031 Views)

Hi again,

 

both solutions presented do what you ask for. If in my example instead of generating values between 0 to 100 you generate values between -100 to 100 (for example) you will notice that the behavior of the minimum value is as you want. Run the code and you will notice it.

 

If you specify the datatype it will be easier to provide you a better example/solution.

 

"Overcome your challenges"

Adriana Oliva - DM Integrations
0 Kudos
Message 6 of 7
(1,011 Views)

The difference between the two examples is that I use a chart instead of a graph, which is useful if data arrives continuously and prevents memory issues because charts have a fixed history length.

 

Storing an ever-growing array in memory can lead to performance problem and doing array min&max on an ever-growing array gets harder with time. In is entirely sufficient to to keep track of the scalar min and max as I do.

 

(There are some other odd points in the example by "di". For example why is the shift register initialized with an array containing a zero instead of with an empty array? A zero might not be a reasonable value at all, for example if all values are negative, the max will be fixed at zero from the beginning. Also "insert into array" is not the right tool to append to an array, "build array" is. Insert into array is a significantly more complicated function, only needed when inserting somewhere in the middle of an existing array, moving all higher elements up in memory. Well, the compiler will sort it all out, but the diagram is still less readable because it is less obvious what actually happens if the index is not connected)

 

As mentioned, you should only rewrite the properties if the max/min has actually just changed (which will get rarer and rarer in your scenario). Properties are relatively expensive.

 

We typically can get significantly more specific advice if you would attach a simplified simulation of what you are doing, giving us a much better picture of what you have and what you want.. Thanks!

Message 7 of 7
(1,000 Views)