Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How can I combine a Stacked Bar and a Line Graph on one chart

I have two charts which I would like to combine onto one QlikView Sheet Object ( see images below ).

I set Chart Properties > Dimensions YEAR and GENDER

with a count(ID) Expression which provides the Stacked Bar perfectly.

However, when I add the Expression AGE with Trendline = Average, I get no option to choose Display Options = Line. It is dimmed out.

The problem is that when I add the AGE expression, I lose my Stacked Bar in each Gender splits into its own bar. Not sure why.

My data table has fields ID, YEAR, GENDER and AGE.

Any suggestions ?

error loading imageerror loading image

9 Replies
johnw
Champion III
Champion III

I believe this was asked pretty recently, and I believe the answer was "you can't". About the best you can do, if you MUST have it look that way, is to build two charts, make the top one transparent, and line them up manually to look like a single chart. You'll need to make sure they always display the exact same X values, and have the exact same range of Y values for the axis.

I believe there's a request on the customer portal to support this kind of chart. If you have access to the customer portal, you could go in and promote that request to make it that little bit more likely that QlikTech will provide a solution that little bit sooner.

Not applicable
Author

Create a combo chart. One with line chart dimensions on left-bottom axis and the other bar or a stacked bar with dimension on right-top. The check boxes are available in the presentation tab. choose combo, line and bar check boxes from the general tab.

But i have adifferent issue. In a single chart i have to create a bar chart for the total expression at national level and line charts for regional level. I can show them in seperate charts but the requirement is to show them in a single chart. In addition I have to show anothe line for goals values that is only at nation level. no link with regions. If i bring them as variables in my script from the resident tables, how can i put all these values into a table so that i can use that cross table for creating this single graph. the values should look like this

w x y z

Goal v1 v2 v3 v4

region v5 v6 v7 v8 --- 5 rows like this. I can sum thes 5 rows to get the national values.

My question is how to load variables that i create using SET and bringing values from the resident tables for the regions.

I mean some how if iget values v1 to v8 or more. how to load them internally into a table as above.

I must have used more words to explain than necessary.

Not applicable
Author

Ouch - so there is no combining of a Stacked Bar chart with one or more Lines. Shame.

Oh well - I will take your "workaround" advice and attempt to combine the two charts by making the Line Chart background transparent.

I assume I will need to get into some sort of event programming to keep the scales and chartsize aligned as the non-transparent chart is resized and rescaled.

Thanks though - I'll jump in and see how all of that is done.

johnw
Champion III
Champion III


MahanMurthy wrote:Create a combo chart. One with line chart dimensions on left-bottom axis and the other bar or a stacked bar with dimension on right-top. The check boxes are available in the presentation tab. choose combo, line and bar check boxes from the general tab.


I can't make that work for me. As soon as I add the second expression, the Subtype radio button on the Style tab goes away, and the bars unstack. Am I missing something simple? Can you post an example?

johnw
Champion III
Champion III


sungrebe wrote:I assume I will need to get into some sort of event programming to keep the scales and chartsize aligned as the non-transparent chart is resized and rescaled.


I'd personally just uncheck "Allow Move/Size" on the Presentation tab. There might be a way to use macros to keep them in sync, but it sounds like a whole lot of trouble for very little benefit if it's even possible. Plus when you use a macro, QlikView flushes its buffers, so it can impact performance.

And I just noticed that you're using separate axes - one a %, one a number. So you don't have to worry about lining up the Y axis values, only the X axis values. That makes it easier.

Not applicable
Author

Thanks John. Advice well taken.

I've just been investigating the Triggers and Macros when the user resizes thru a OnActivate action. Seems like overkill.

I'll lock the chartsize and make the Line Charts transparent to overlay the Stacked Bars.

Trouble is, I'll need to disallow the Excel Exports from the Title Bar since I have no idea how to determine which chart was selected !

johnw
Champion III
Champion III

Well, yeah, I'd remove the default Excel export, since it would only get the top chart. They can still right click and export, but again, this will only get them the top chart. If you can figure out what you want them to be able to export, and build it as a straight table, you might be able to shrink that straight table down until it is nothing BUT an Excel export button. Put that on top of both layers of charts, and the users will be none the wiser. Not sure how will it would work in practice, and it'll probably double the computation time (probably won't matter), but it sounds doable on the surface.

And yeah, it would all be simpler if QlikView just directly supported overlaying lines on stacked bar charts. Hopefully some day.

jsimmonstx
Creator
Creator

And here we are, six years later, with no action fro QlikView.

patrou38
Creator
Creator

Hello,

I'm in front of the same issue.. is someone have a solution , Workaround ?

thx.