Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
IAMDV
Luminary Alumni
Luminary Alumni

*** Expression As Legend ***

Dear All,

Quick question on chart properties. I am working on building a VB Script code repository for Chart Objects. I need the name of the property to toggle the Expression As Legend option. I had looked into the API guide and could not find one. Please can someone answer this one?

Many thanks in advance.

Cheers - DV

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    Try this code.

   

sub abc

set chart = ActiveDocument.ActiveSheet.CreateBarChart

chart.AddDimension "CustomerID"

chart.AddExpression "sum(1)"

chart.AddExpression "count(1)"

set p = chart.GetProperties

set expr = p.Expressions.Item(0).Item(0).Data.ExpressionVisual

expr.ShowExpressionLabel = true 'True to check Expression as Legend

set expr = p.Expressions.Item(1).Item(0).Data.ExpressionVisual

expr.ShowExpressionLabel = false 'false to uncheck Expression as Legend

chart.SetProperties p

end sub

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

2 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    Try this code.

   

sub abc

set chart = ActiveDocument.ActiveSheet.CreateBarChart

chart.AddDimension "CustomerID"

chart.AddExpression "sum(1)"

chart.AddExpression "count(1)"

set p = chart.GetProperties

set expr = p.Expressions.Item(0).Item(0).Data.ExpressionVisual

expr.ShowExpressionLabel = true 'True to check Expression as Legend

set expr = p.Expressions.Item(1).Item(0).Data.ExpressionVisual

expr.ShowExpressionLabel = false 'false to uncheck Expression as Legend

chart.SetProperties p

end sub

Regards,

Kaushik Solanki

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

Kaushik - You are the star mate. Thank you very much for the code. Just curious to know... where are you based? and since how long are you using QV?

Also please can you help me with this post....

http://community.qlik.com/message/126614#126614

Cheers - DV