Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

create scatter chart through macro

hi all,

How can we create an new scatter chart in macro by providing Dimensions and Expressions ?

In my current app's i provided two Buttons, first button when i click that it should create a new sheet and in that new sheet scatter chart should create.

And when second button i click then it should delete the recently created scatter chart object and sheet.

Is it possible ?

Thanks in advance.

Regards

Venkat

3 Replies
m_woolf
Master II
Master II

This is one of eighteen sample scripts from the API Guide:

set chart = ActiveDocument.Activesheet.CreateScatterChart

chart.AddDimension "Customer"

chart.AddDimension "ProductType"

chart.AddExpression "avg(Amount)"

chart.AddExpression "avg(Price)"

cset col = ActiveDocument.GetApplication.GetSolidColorArea(255,0,0) 'red

chart.AddFractLine 0,0,col

set p = chart.GetProperties

set rl = p.ChartProperties.RefLines.Item(0)

rl.Fractile = true

rl.FractileLevel = 50

rl.Legend.v = "median"

rl.Color.PrimaryCol.Col = RGB(255,0,0)

rl.XAxis = true

rl.YAxis = true         

chart.SetProperties p

Not applicable
Author

Hi,

when i used your macro i is showing an error Type Mismatch in below line.

cset col = ActiveDocument.GetApplication.GetSolidColorArea(255,0,0)

what i need to change in the above line not get the Type Mismatch error ?

Thanks in advance

Regards

venkat

m_woolf
Master II
Master II

cset should just be set

You should look at the other 17 sample scripts in the API Guide.