Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.


Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Honored Contributor II

Macro to Change Y Axis

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


SET chart = nothing

SET cp = nothing


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