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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Create a dynamic Chart

Hello,

I am trying to make a document using macro.

But if I use a calculated dimension, It makes an error in changing the label.

How can I fix it ?

Thanks,

Wan Ki,

sub chartDraw

objs = ActiveDocument.ActiveSheet.GetSheetObjects

for i=lbound(objs) to ubound(objs)

  if objs(i).GetObjectType = 12 or objs(i).GetObjectType = 16 then

  objs(i).Close

  end if

next

set Graph = ActiveDocument.ActiveSheet

set chart = Graph.CreateComboChart

chart.AddDimension "=if(YEAR<>'2015', YEAR)"  ' "YEAR"

chart.AddDimension "MONTH"

chart.AddExpression "sum(Sales)"

chart.AddExpression "sum(MONTH)"

chart.AddExpression "sum(Sales)/100"

set p = chart.GetProperties

set di = p.Dimensions

di.Item(0).Title.v = "SUB_GRP"     ' --> Error occurs.

di.Item(1).Title.v = "Date"

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

expr.ShowAsBar = false

expr.ShowAsLine = true

expr.ShowAsSymbol = true

expr.Label.v = "Sales"

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

expr.ShowAsBar = false

expr.ShowAsLine = true

expr.ShowAsSymbol = true

expr.Label.v = "Count"

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

expr.ShowAsBar = false

expr.ShowAsLine = true

expr.ShowAsSymbol = true

expr.Label.v = "Rate"

p.ChartProperties.MajorDimensionTextMode = 2   ' 

chart.SetProperties p

end sub

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

4 Replies
Anonymous
Not applicable
Author

Hi,

have you seen this discussion?

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

Unfortunately, I tried as they suggest, but I didn't be able to solve the problem...

Not applicable
Author

P{font-size:9pt; line-height:16; margin-left:0; margin-top:0;

margin-right:0; margin-bottom:0; font-family:굴림;}Hello,

 

I am very sorry about my delayed reply 

My case us some deferent 

Anyway tahno you so much for you reply

 

WanKi,

 

======================================================

(주)알인포스(Research &amp; Information Services Co Ltd,)

SI 사업부 상무 / 전 완기(Jeon WanKi)

Anonymous
Not applicable
Author

Not applicable
Author

Hi Elena888

Thank you for you information.

It will be very helpful.

Thank you,

WanKi,