3 Replies Latest reply: Oct 15, 2014 11:47 AM by Alan Farrell RSS

    Hiding the Y axis using macro

    Brian Booden

      I have written a small macro to hide the X-axis on a (bar) chart when a button is pushed, as per below:


      sub HideXAxis
                set chart = ActiveDocument.GetSheetObject("CH111")
                set p = chart.GetProperties
                p.ChartProperties.XAxis.Show = false               
                chart.SetProperties p
      end sub


      I also want to be able to hide the Y-Axis at the same time, but cannot find the syntax to do it.  Is this possible, and if so, how?




        • Re: Hiding the Y axis using macro
          Brian Booden

          Can anyone make any suggestions on this?  I have had another good sift through the API Guide and cannot find equivalent Y-Axis properties.


          I have a manual workaround currently where i can set the the font colour of the Y-Axis to the colour of the background, effectively hiding it, using a variable as a toggle.  But i am not keen on embedding expressions into every font colour of Y-Axis objects through my application.  I would rather trigger the properties through a macro, similar to my previous post.


          Any suggestions would be really appreciated.




            • Re: Hiding the Y axis using macro

              He Brian,

              Why don't you make two different graphs. One graph with an y-axis and one graph without an y-axis.

              Then show the graphs conditionally, dependent of the value of a variable.

              You can create a button to change the value of the variable.


              For eg:

              Make a button wich sets the variable vShow to 0. And one button to set the variable vShow to 1.

              If vShow=0 you show the graph with the y-axis. If vShow=1 you show the graph without the y-axis.


              This way you don't need a macro and you can use a trigger which will still work with ajax client.


              Hope that helps.




              • Re: Hiding the Y axis using macro
                Alan Farrell

                Hi Brian,


                Did you ever figure this out?