02-26-2014 09:35 AM
I'm working on a program which will allow users to plot up to 5 different channels with indepdnant y axes. I make them visible / invisible depending on how many channels are being plotted. Unfortunately, the axes start to overlap eachother. I decided to programmatically fix this
The code works just fine initially (for preventing the axes from overlaying eachother), but quickly mess up once you start making them visible / invisible.
Any thoughts / solutions?
Solved! Go to Solution.
02-26-2014 10:59 AM - edited 02-26-2014 10:59 AM
@BowenM wrote:
I'm working on a program which will allow users to plot up to 5 different channels with indepdnant y axes. I make them visible / invisible depending on how many channels are being plotted. Unfortunately, the axes start to overlap eachother. I decided to programmatically fix this
[code snippet not copied here]
The code works just fine initially (for preventing the axes from overlaying eachother), but quickly mess up once you start making them visible / invisible.
Any thoughts / solutions?
Well, a couple of things (okay, three) come to mind. First, you don't need to use two different property nodes inside your for loop if you are referring to the same axis - just use one property node and pull down a second property. That way you won't have a chance of mixing things up.
Second, you could use a for loop set to only include the axes/plots you want visible with autoscaling N to an array of your visible plots, then your axes would all be spaced identically.
Third, you could set the plot position and size to move over and shorten as more y axes are made visible, so you take up the same amount of screen real estate for any case.
Other customizations are possible, but these should get you where you say you want to be.
Cameron
02-26-2014 11:13 AM
First: Trivial. Not relevant to the problem.
Second: If you look, another one of the problems is that this method forced the axis over in to the plotting area (which wasn't the case initially). Once it was forced there, the only way I could figure out how to fix it was customize the control and force it back. I could call this function every single time a plot is made vis/invis to prevent overlay, but it wouldn't prevent it from somehow forcing the axis in to plot area.
Third: LV takes care of this automatically (or is supposed to) as you make more axes vis/invis. In fact, I played with setting plot area, and it doesn't really have any affect. Moving the axis will move the plot. Moving the plot area will move the axis.
02-26-2014 01:54 PM
Here is a rough VI which will hopefully illustrate the problem. Spend some time clicking plots on and off and you should be able to see the unusual behavior.
02-26-2014 01:54 PM - edited 02-26-2014 01:55 PM
Odd. Posted twice, and attached the VI twice. Ignore this one 😛
05-27-2014 09:10 AM
Shameless bump. I had to drop this project for awhile and am working on it again. I still haven't found a solution. Any help would be appreciated!
05-27-2014 11:24 AM
I finally found a solution. I'll leave it here if anyone else stumbles across this post in the future.
You need to right click on the graph, and select Advanced >> Auto Adjust Scales. This will turn off the behavior of turning on and off axis resizing the plot area (which is what was causing the problems to start with). Then you just manually set all of your sizes and positions.
Note: you will want to add error handling in to this section. If you have zero plots visible, it will return an error.
05-27-2014 11:31 AM
Um, I think that's basically what I said (case 3, anyway). I guess I didn't mention the AutoAdjusting, because I rarely autoadjust things (now you know why).
05-27-2014 12:12 PM
@camerond wrote:
Um, I think that's basically what I said (case 3, anyway). I guess I didn't mention the AutoAdjusting, because I rarely autoadjust things (now you know why).
It is what you mentioned and what I had tried previously, but without turning off the Auto-Adjusting, it does not work. Even then, the order you do it in matters (set plot area before y scale position). I ended up building this in to a sub-vi and never again will use the auto adjusting. It broke too often...