• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Charting - hide an axis with a checkbox

GeorgeF211

New Member
Is it possible to hide/show an x or y axis with a checkbox? Basically I've got a chart with two y axes, one showing value, one showing volume. I'm controlling if value or volume or both are plotted with two checkboxes, is there a way to say "If (linked cell) is true, show (y1 or y2)"?


I'm happy with VBA if that's what's needed, but I'm not overly familiar with it, so if you could put comments in so I can reverse engineer it that'd be great.


Cheers,


George
 
George, just to clarify - do you want know hide/show a series based on a checkbox value - or, is there just one series but you want to display one (or two) different axes for the series?
 
Maybe with some trickery? What you could do it create 2 dummy series that will act as the y-axis, 1 for value and 1 for volume. They would be controlled by a formula and plot a vertical line, similar to the dummy x-axis seen here:

http://peltiertech.com/WordPress/fake-line-chart-dummy-xy-series-for-x-axis/


If the checkbox was linked to cell A2, formula for line would be something like:

=IF(A2,Value,NA())


So that the NA error would cause the line not to be plotted when the check box is not marked.


Looking over this post, I know it's a bit of a ramble, but hopefully the concept is conveyed. In a nutshell, create some dummy series that will act as the y-axis, and then you can easily control whether they are visible or not.
 
Thanks Luke. Looks like that involves using some third party things, which is an issue on a work machine. Getting the data series and all that to work isn't an issue, it's just having this axis is a bit ugly when it's not needed.
 
No, doesn't necessarily need to use 3rd party. Jon just offers his utility as a way of "you could do all this work, or let me do it for you". I referenced the article as a way of showing a chart that uses a dummy series. You could certainly setup the formulas and chart on your won w/o any other software.
 
Back
Top