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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Change the chart style on listbox selection

Hi

I have created a varible to store the value selected in the listbox.

what i am trying to do is to check if variable is not blank then chnage chart style to pie and if its blank change chart style to pie

1 Solution

Accepted Solutions
giakoum
Partner - Master II
Partner - Master II

sub SetChartType

  set chart = ActiveDocument.GetSheetObject("CH01")

  intObjectType = chart.GetObjectType

  if intObjectType = 15 then    'is currently a line chart

  chart.SetChartType  2

  else

  chart.SetChartType  4

  end if

end sub

just replace the fixed values with your variable. this code is copied from some earlier discussion which unfortunately I cannot find at the moment...

Of course you can always use Fast Type Change from the chart properties instead of a macro...

View solution in original post

2 Replies
giakoum
Partner - Master II
Partner - Master II

sub SetChartType

  set chart = ActiveDocument.GetSheetObject("CH01")

  intObjectType = chart.GetObjectType

  if intObjectType = 15 then    'is currently a line chart

  chart.SetChartType  2

  else

  chart.SetChartType  4

  end if

end sub

just replace the fixed values with your variable. this code is copied from some earlier discussion which unfortunately I cannot find at the moment...

Of course you can always use Fast Type Change from the chart properties instead of a macro...

Jason_Michaelides
Partner - Master II
Partner - Master II

How about creating two different objects (chart and a pie) and using a conditional calc and show based on the variable value?