2 Replies Latest reply: Oct 25, 2011 6:19 AM by Kiran Rokkam RSS

    Change Scatter Chart Dimenions on the fly...

    Brian Sturgis

      Does anyone know if there is a way to change the dimensions of a chart, specifically a XY scatter chart, on the fly using buttons or actions?  What we want to do is give the user the ability to create their own chart by giving them a set of buttons the will change either the X or Y axis with the dimension or measure of their choice.

        • Re: Change Scatter Chart Dimenions on the fly...
          Steve Baldwin

          Hi, you would need to set the some variables with the names of the fields you want on the X/Y axis then use a $ expansion, i have included a really simple example.

           

          Thanks

          Steve

          • Re: Change Scatter Chart Dimenions on the fly...

            Expression can be dynamically changed using variables. Dimension toggle needs macro to change.

             

            For example:

            Create a variable vSelectDimension and assign it a value when a button is clicked.

            Add the below macro in the macro editor and call it in the button

             

            Sub ToggleDimension

            set chart = ActiveDocument.GetSheetObject("CH01")

            Set TB = ActiveDocument.Variables("vSelectDimension")  'Can be Variable/Listbox selection/Possible Values/Selected values etc...

            NewDim = TB.GetContent.String

            chart.RemoveDimension 1  'Remove Old Dimension

            chart.AddDimension NewDim   'Add New Dimension

            End Sub

             

             

            Hope this helps,

            Kiran.