Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set "Max Visible Number" (Presentation Tab) in Diagram by Macro? (QV10)

Hi,

I would like to create a macro (to be executed with a button) which sets the property "Max Visible Number" in the upper right corner of the Presentation Tab in the options of a bar diagram, on e.g. 10 or x+5 or something like that. Unfortunately I can't find specific information in the API Guide. Has perhaps someone experience with that? Thanks a lot in advance, Martin

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    I got the solution.

    Try this.

   

set chart = ActiveDocument.Sheets("Main").CreateBarChart

chart.AddDimension "F1"

chart.AddExpression "count(F1)"

set cp = chart.GetProperties

set dims = cp.Dimensions

dims(0).MaxNumShown.v = 10

chart.SetProperties cp

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

15 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    Here is the code from API guide to set the maximum visible number.

  

set chart = ActiveDocument.Activesheet.CreatePivotTable

chart.AddDimension "ProductType"

chart.AddExpression "sum(Amount)"

chart.AddExpression "count(Customer)"

set cp = chart.GetProperties

set dims = cp.Dimensions

dims(0).MaxNumShown = 10

chart.SetProperties cp

This will set the value to 10 for the dimension "ProductType"

and that is specified by this line

dims(0).MaxNumShown = 10

Hope this will help you

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Hi, thanks a lot for your help. I tried it but when I click the button it shows me this:

110817_0912.png

The text means something like "Wrong number of arguments or invalid property assignment".

Where is my mistake?

Thanks,

Martin

PS: Is there some kind of overview somewhere which shows me information like this one? (e.g. the fact that this property is called MaxNumShown)

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    Can you please translate the error you got at the top in english.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Hi,

I did, below the image. 🙂

This is what google-translation says:

"Wrong number of arguments or invalid property assignment: 'dims (...). MaxNumShown'"

Regards,

Martin

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    Can you tell me what are the dimension you have specified in your charts.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Hi,

I have just a simple example with one dimension "Firma" (Account):

110817_0943.png

110817_0944.png

Regards,

Martin

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    I checked, but the code given in API is not working.

    Sorry, i am working on this. Will let you know if i get any solution on this.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
kji
Employee
Employee

I think the problem is you are giving a number for a string parameter, try with

dims(0).MaxNumShown = "10"

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    I got the solution.

    Try this.

   

set chart = ActiveDocument.Sheets("Main").CreateBarChart

chart.AddDimension "F1"

chart.AddExpression "count(F1)"

set cp = chart.GetProperties

set dims = cp.Dimensions

dims(0).MaxNumShown.v = 10

chart.SetProperties cp

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!