0 Replies Latest reply: Oct 15, 2014 11:53 AM by Alan Farrell RSS

    Macro to Change Y Axis

    Alan Farrell

      Hi All,

       

      I have the following code that creates a Scatter Chart

       

      SUB CreateScatterChart

       

      SET chart = ActiveDocument.Sheets("Main").CreateScatterChart

      chart.AddDimension "Company"

      chart.AddExpression "sum( round (256*pow(2,($(var_zoom)-1)))+( lng  *((256*pow(2,$(var_zoom)))/360)))"

      chart.AddExpression "sum(((256*pow(2,($(var_zoom)-1)))+((0.5*log((1+(sin((lat)*pi()/180)))/(1-(sin((lat)*pi()/180)))))*((-256*pow(2,$(var_zoom)))/(2*pi()))))) "

      chart.AddExpression "SUM(Licenses)"

      SET cp = chart.GetProperties

      cp.Expressions.Item(0).Item(0).Data.AxisData.Min.v = "=(256*pow(2,($(var_zoom)-1)))+( var_mid_long  *((256*pow(2,$(var_zoom)))/360)) -round(map_size_x/2)"

      cp.Expressions.Item(0).Item(0).Data.AxisData.Max.v = "=( (256*pow(2,($(var_zoom)-1)))+( var_mid_long  *((256*pow(2,$(var_zoom)))/360)) + round(map_size_x/2))"

      cp.Expressions.Item(0).Item(0).Data.AxisData.Force0 = false

      cp.Expressions.Item(0).Item(0).Data.AxisData.Grid = false

      chart.SetProperties cp

       

      'Cleanup

      SET chart = nothing

      SET cp = nothing

      END SUB

       

      And I get the following result, but how can I also set the Y Axis with similar Value through the Macro.

       

      Axis.png