LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Chart XScale Changes with Tabs

So I've been trying for awhile to get my data charts to show the correct XScale Range. Everything's fine until I change the tab that contains my data. When I return to the tab with the chart, the XScale changes to be at the end of the History (with the same span), no matter what. This is very annoying. Now I have to write code to update 10 charts with the XScale that I have to save when I leave the tab, and I also have to keep up with when to discard the saved values (e.g., when the acquisition is reset or the configuration is changed).

 

Is this the expected behavior? If so, this is very counter-intuitive. One might think that a chart should show what the user wants to see... or at least do what the graph does in this respect.

 

I have attached a simple VI (9.0.1) that demonstrates this "expected" behavior. Basically, it's just a chart on a tab control. I put some random data in it, change the XScale Range, and then flip tabs forth and back to show that the scale changes. I added a graph to illustrate that the graph control does not have this behavior.

 

This is more of a rant than a question, but maybe it will help someone else who is trying to track down the same behavior.

 

_______________________________________________________________
"Computers are useless. They can only give you answers." - Pablo Picasso
0 Kudos
Message 1 of 6
(2,964 Views)

Try turning off the "AutoScale X" feature from right-clicking on the Chart Scale.

0 Kudos
Message 2 of 6
(2,962 Views)

As the example shows, the AutoScale X is off and the behavior persists. In fact, the graph has AutoScale X On and it doesn't have this behavior. This is that same in LV2010 as well.

 

I guess my only point is that the chart and graph do not behave the same way when it comes to this issue, and I wonder why this is. Is it a bug associated with charts on tabs or is it just the way it is.

 

It seems that what is happening is very similar to (exactly what happens?) when you post data to the History Data property node. Since it is a chart, the most recent data is automatically shown. But instead of only happening when data is posted, it appears that there is some under-the-hood code that is "reposting" the data whenever the chart is drawn on the front panel. I can see how changing that would impact many things (and how do you keep track of what the scales were, how do you know if I've changed them programmatically since last time you saw it, etc.). I just think it's kind of lame that I have to do it myself, and that the screen will flicker as the charts update (since you cannot capture a "Tab Control: Value Change?" event.

 

Just my 2 cents.

 

_______________________________________________________________
"Computers are useless. They can only give you answers." - Pablo Picasso
0 Kudos
Message 3 of 6
(2,952 Views)

OK, I can confirm the behavior you are seeing. I would agree that this might swing toward "unexpected" behavior, but perhaps it is expected as a feature of the Chart. As you suggest, perhaps when a chart is invalidated, the display window is updated to the show the most recent data points in anticipation of new data.

 

You may not like this workaround, but you might try the XY graph instead of the Chart. (Both the Chart and the Graph are a subset of the fully functional XY Graph.) It's the most flexible, and I use it exclusively.

0 Kudos
Message 4 of 6
(2,944 Views)

Has this behavior (I hesitate to say bug) been resolved?

 

I see the same behavior in LV 2012, and was hoping for a simple fix rather than having to write Tab Event cases to resolve.

0 Kudos
Message 5 of 6
(2,726 Views)

Really odd and undesirable behaviour.

There is something similar going on when you try to change the chart x-scale minimum / maximum programmatically. When this chart is on a tab page that is not visible, it will not update. It only does the update when selecting and showing the tab page with the chart and then change the chart x-scale minimum / maximum programmatically.

 

That being said, sometimes it seems to update. However, I have not gone through a thorough series of tests to determine exactly when it does update and when it does not.

0 Kudos
Message 6 of 6
(2,521 Views)