LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

turning off X axis autoscale in a CHART

Solved!
Go to solution

Hallo !

Has anyone an idea about the following:


I want to use a waveform CHART (as opposed to graph) because I like the possibility of pushing single values into it.

But I while my code pushes values into the chart, the X-axis (also the y axis) SHOULD be fixed.

I set the autoscale OFF, but still the chart updates the X axis.

In the attached code I set it to 0..15, but LabView changes it to 9..24.

He keeps the difference max-min = 15 but not the exact values.

I dont understand... what is the meaning of X autoscale-off, if not staying like I set it to be...

What am I missing ?

Is there a secret property I can set ?

If not, is there a easy way of preventing the chart (only the chart) of updating at all, but still rembering the values

I push in for a later update?


The reason to do is, is to zoom in and zoom out with a given X_min & X_max.

This is LabView2015 on Linux.

Thanks in advance for any hint.

 

 

0 Kudos
Message 1 of 11
(994 Views)
0 Kudos
Message 2 of 11
(992 Views)

question_autoscale.png

Heres the screenshot

0 Kudos
Message 3 of 11
(991 Views)

Then dont write your data to chart before it should be displayed. Store the data in a intermediate array.

0 Kudos
Message 4 of 11
(968 Views)

Hi Seb,

 


@Seb77 wrote:

I want to use a waveform CHART (as opposed to graph) because I like the possibility of pushing single values into it.

But I while my code pushes values into the chart, the X-axis (also the y axis) SHOULD be fixed.

I set the autoscale OFF, but still the chart updates the X axis.

In the attached code I set it to 0..15, but LabView changes it to 9..24.

He keeps the difference max-min = 15 but not the exact values.

I dont understand... what is the meaning of X autoscale-off, if not staying like I set it to be...


Charts and graphs have their use cases, advantages and disadvantages. You need to evaluate all of their properties when selecting the tool for your requirement!

 

AutoScaling the X axis for a chart influences the number of samples shown in the chart:

  • you can enable AutoScaling to show the whole history buffer of the chart
  • you can disable AutoScaling to show less samples then are in the history buffer

When you set a history buffer size of 16 samples/elements then the chart will show those 16 elements of the history - and it will also show the indices of those 16 elements. As you write new samples into the history buffer the indices of those elements will change too.

 

When you want to use fixed X axis values then you should use a graph, maybe even a XY graph!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 11
(928 Views)


Thanks, Quiztus2
yes not sending new values and instead buffering somewhere I take care of would be a workaround,
but that kind-of removes the benefits of a chart over a graph.
Also IF new incoming values fall in the range X_min...X_max I also want them
to be displayed right away, but the workaround would "freeze" the chart.
Still looks like I will have to go for this workaround...


Thanks a lot GerdW.
OK, I understood the difference between charts and graphs like this:

arrays into CHARTS: can be send into "history"-> they always overwrite the entire (!) history
scalars into CHARTS: can be send into "value" and then they append to history
arrays into GRAPHS: yes, just display
scalars into GRAPHS: no, there is nothing like "appending"


So do I understand you correctly, that in a CHART the "X-autoscaling-OFF"
actually does mean the following:
"autoscaling of range (x_max-x_min) is OFF but autoscaling of X_min is still ON"
...and there is no easy workaround?

Maybe let me add this information: I use a TRANSPARENT chart on top of a graph.
I got this idea from your or Altenbachs old posts I think.
In the GRAPH I have a lot of old data (plots), that dont change, except
the axis scaling and all NEW values coming in I send to that CHART.
After one hour or so the plot in the chart is completed and I send it to the backround (the GRAPH).
This way I dont have to resend big data every time a new value comes but
just one value to the chart.
Works really good as long as my chart sees no reason to
autoscale (the above topic).

0 Kudos
Message 6 of 11
(918 Views)

Hi Seb,

 


@Seb77 wrote:

So do I understand you correctly, that in a CHART the "X-autoscaling-OFF"
actually does mean the following:
"autoscaling of range (x_max-x_min) is OFF but autoscaling of X_min is still ON"
...and there is no easy workaround?


No, there is no "easy workaround". Charts only have limited capabilities regarding X axis handling.

 


@Seb77 wrote:

Maybe let me add this information: I use a TRANSPARENT chart on top of a graph.
I got this idea from your or Altenbachs old posts I think.
In the GRAPH I have a lot of old data (plots), that dont change, except
the axis scaling and all NEW values coming in I send to that CHART.
After one hour or so the plot in the chart is completed and I send it to the backround (the GRAPH).
This way I dont have to resend big data every time a new value comes but
just one value to the chart.
Works really good as long as my chart sees no reason to
autoscale (the above topic).


Altenbach usually gives very good suggestions!

What's the problem to place a transparent graph over your background graph? Then you get full control of the graph's X axis and only need to collect your measurement data on your own. Should be easy enough to create/handle an array of samples…

(Or the other way around: why don't you increase the chart history buffer so you don't have problems with the scrolling of the X axis?)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 11
(914 Views)
  • Restarting the VI in the same edit session does not clear the chart history, if you want to start with an empty history buffer with every run, you should clear it first (see picture). This will work OK as long as the number of points is less than the chart history.
  • Any simple VI with a completely pointless sequence structure is suspect in many ways.
  • I have no idea why you have the chart terminal disconnected in its own frame and then write to it via a value property. Silly!
  • Properties that remain the same do not need to be written with every run. none of your property nodes are needed.
  • Be aware that the sine function takes radians, so wiring an integer ramp will probably not give you a nice display

 

 

 altenbach_0-1705104709731.png

 

 

How does your code fit in the rest of your project?

0 Kudos
Message 8 of 11
(881 Views)

Dear Altenbach,

thanks a lot for your reply.

The code example from the top post was just to demonstrate the issue. Its not my (very large) project

Yes, I get your point with the sequence structure and the sine.

And yes, the property nodes... but  unfortunately labview has no "set-this-way-at-compile-time"-property-node.

 

Let me get back to the main issue, because I feel that this is important for many users in physics and related:

One wants to plot incoming measurement points in real time, maybe 2 values a second, and

give the user the possibility to EITHER use autoscale-X (timescale) or a manually set (by him) X-scale .

 

With this you run into a problem as pointed out by GerdW if you use a CHART.

You cannot really turn-off the autoscale-X (time) in a chart (instead, only the range x_max-x_min).

This is what I wanted to point out with the top example.

The "history length" was set to a larger value than what would ever enter the chart.

30 in the example, 36,000 in my real code.

GerdW suggested to use a GRAPH instead of a chart. OK. Sounds good.

But then I loose the possibility to send a SINGLE VALUE.

which makes life easy if you -lets say - get new measured values from a queue.

So comparing  CHARTS and GRAPHS, let me show this:

chart_vs_graph.png

Whith GRAPHS, if I record data for a long time I will end up sending an array with huge size every loop iteration.

 

So the question here is: How to append one value to a existing plot ( with long length) efficiently.

There have been posts to this subject, but they somehow dont reveal to me.

Or am I missing something ?

  • There is no such thing as a property node that sends a single value to a GRAPH,  right ?
  • And there is also no way to manipulate (append to) the active plot that is within a GRAPH, right ?
0 Kudos
Message 9 of 11
(798 Views)

Hi Sebastian,

 


@Seb77 wrote:

Whith GRAPHS, if I record data for a long time I will end up sending an array with huge size every loop iteration.


It is your responsibility (as programmer) to handle the internal arrays in an efficient way!

 

It doesn't make sense to plot 36000 samples on a chart/graph with only ~500 pixels width, so why do you think you need to create such large arrays in the first place?

 


@Seb77 wrote:
  • There is no such thing as a property node that sends a single value to a GRAPH,  right ?
  • And there is also no way to manipulate (append to) the active plot that is within a GRAPH, right ?

No, there is no property node to append single samples to existing plots.

There is a way to manipulate graph plot data: hold the data in a shift register and append samples using BuildArray. This is quite efficient and allows you to manipulate the plot data in any way you like!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 11
(786 Views)