Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to set Chart Property

Hi All,

I have a chart area and I have two different drill downs which I am controlling through buttons by toggleing and assinging dimensions programatically using VB Script.

My question is that how to set Property of Chart->Presentation->Max Visible Number and Show X-Axis Scrollbar using VB Script.

Sample code would be a great help. Ive tried finding in API Guide but cudnt find.

Thanks and regards

Josh

4 Replies
Not applicable
Author

Josh,

Macros that set attributes of an object are always best avoided as they cause instability in the document.

Always better to have multiple charts that are activated/hidden as appropriate.

Regards,

Gordon

Not applicable
Author

thanks for your reply Gordon and agreed to some extent but what is the use of Scripting and direct access to objects and their properties in this product then?

Not applicable
Author

In the server environment, that is a question I have asked myself to be honest! I have just posted a question about OnPostReload which confuses me some more...

Not applicable
Author

This is not a solution, but I believe, an pointer in the right direction. Some objects have methods called get and setProperties. They are not well documented, I believe, but they hold assorted properties like the two you are looking for. Maybe those you want are there too.

ActiveDocument.getsheetobject("mainReport").addDimension("=if($(ReportFilter2),Category,null())")
filterSet = true
set Graph = ActiveDocument.GetSheetObject("mainReport")
set cp = Graph.GetProperties
set dims = cp.Dimensions
dims(dims.Count-1).Title.v = "Category"
dims(dims.Count-1).NullSuppression = true
dims(dims.Count-1).ColWidth = 400
dims(dims.Count-1).SortCriteria.SortByAscii = 1
dims(dims.Count-1).SortCriteria.SortByLoadOrder = 0
Graph.SetProperties cp