LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple y axes overlay eachother

Solved!
Go to solution

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

 

 

 

y axis.png

 

The code works just fine initially (for preventing the axes from overlaying eachother), but quickly mess up once you start making them visible / invisible.

 

plot.PNG

 

Any thoughts / solutions?

0 Kudos
Message 1 of 9
(3,014 Views)

@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

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
Message 2 of 9
(2,995 Views)

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.

0 Kudos
Message 3 of 9
(2,988 Views)

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.

Download All
0 Kudos
Message 4 of 9
(2,969 Views)

Odd. Posted twice, and attached the VI twice.  Ignore this one 😛

Download All
0 Kudos
Message 5 of 9
(2,969 Views)

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!

0 Kudos
Message 6 of 9
(2,866 Views)
Solution
Accepted by topic author BowenM

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.

 

multiple yaxis.png

 

 

Note: you will want to add error handling in to this section. If you have zero plots visible, it will return an error.

 

Message 7 of 9
(2,856 Views)

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).

 

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 8 of 9
(2,849 Views)

@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...

0 Kudos
Message 9 of 9
(2,844 Views)