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

Bar graph vs stacked bar graph?

I would like to be able to toggle between a regular bar graph and a stacked bar graph. Is there a way do this?

3 Replies
m_woolf
Master II
Master II

Make both charts. Then use a variable to show or hide the charts as needed.

jduenyas
Specialist
Specialist

You can put this code in your Edit module

Sub ChangeChart()
         set chart = ActiveDocument.GetSheetObject("NAME OF YOUR CHART")
          set p = chart.GetProperties
          if p.ChartProperties.BarModeStacked = True then
                 p.ChartProperties.BarModeStacked = false
          else
                 p.ChartProperties.BarModeStacked = True
          End if
         chart.SetProperties p
End sub

Then you can set a button and its action should point to this Macro.

Each click will toggle between stacked or grouped

Hope it helps.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

If you plan to use a macro that calls chart.SetProperties in the Server environment, please take note of this warning from section 80.2 of the Ref Guide.

"The following types of functionality are not to be used in the QlikView Server environment , as they may

cause unexpected results:

- Layout operations acting on the properties of sheets and sheet objects via SetProperties"

-Rob