The Breakdown Bar Chart – a little bit more (in certain circumstances) than you’re average Bar Chart
The Bar Chart; the ‘Mr Consistent’ of the chart world, you might add a line or two over the top or a few symbol sets here and there, perhaps a little stacking but on the whole; the bars like those of a prison cell never change. That’s not to do the plain ol’ Bar Chart down; along with the Line Chart it’s one of the pillars of data visualization and even in it’s most basic form it can be peerless in the display of data…but can we squeeze any more functionality from it’s stoic constrains? – of course we can!
After creating the Watermark Bar Chart for my previous post (http://qvdesign.wordpress.com/2012/08/09/qlikview-watermark-bar-charts-a-bit-like-bullet-charts-but-not-quite/) I started to think about what other amendments could be made to the Bar Chart to make it even better (in certain circumstances when the data & requirement suits) and I came across the following chart via the ‘Technology’ feed within my FlipBoard iPhone App:
Not exactly The Great Leap Forward in chart evolution but none the less I like it, the chart pushes things a little further than say simply stacking as it allows you to see how 2 dimensions contribute to the Total (Product Group split along the X-axis and Sales Group as the internal stack in this case). We see what the Sales Group breakdown for the separate Product Groups is compared to the overall (the Total bar) which is also something that isn’t made easy using currently available methods.
Whilst this is a chart that’s possible to create in Qlikview currently (there’s a ‘How to’ and .qvw below) it is similar to my previous post in that it’s creation is too bespoke and complex for general deployment – however I see it as something that could be implemented by Qliktech to make it simple to deploy. Again; here’s hoping for Qlikview.next.
So how’s the chart created?
As always you can download a demo .qvw here: https://docs.google.com/open?id=0BxloTMUod74tcVBzMjRWSEhKbjA
To start with here; surprise, surprise; we’re using a Bar Chart as a foundation here (it gets more complicated). There’s a single calculated dimensional value created by my old favorite valuelist():
=ValueList(‘Pickles’,'Meat Products’,'Regional Produce’,'Total’)
These are the individual values the .qvw has in it’s Product Group field, obviously if you had a lot of unique values this method would be a little time consuming – you could instead incorporate a concat() statement to assist you although you’ll need chr() and a variable or two to make it work.
Next it’s on to the Expressions of which we have 5…which is a number determined by the number of unique values in our second ‘dimension’ in this case 3 values in Sales Group (A ‘Previous’ and a Datapoint expression makes 5).
The first expression called ‘Previous’ generates the transparent bar that creates the off-set and is calculated as follows:
=if(ValueList(‘Pickles’,'Meat Products’,'Regional Produce’,'Total’)=’Pickles’,null(), if(ValueList(‘Pickles’,'Meat Products’,'Regional Produce’,'Total’)=’Regional Produce’,sum(if(Product_Group=’Pickles’,Volume)), if(ValueList(‘Pickles’,'Meat Products’,'Regional Produce’,'Total’)=’Meat Products’,sum(if(Product_Group<>’Meat Products’,Volume)), null())))
So here we have if the dimension = ‘Pickles’ this value should be null() as Pickles are the first dimension in our breakdown if it’s ‘Region Products’ the value should be equal to the volume of Pickles as it’s the second value in the dimension and so on to the end of the dimension.
Now it’s a case of building the stacks from there and again each expression has to be bespoke to the dataset which makes this a very laborious chart to deploy.
Finally we add a Datapoint expression to display the subtotal for each Product Group value.
The end result is fully reactive to selections despite the chart’s heavy amount of customization.
So here we have another plea to Qliktech for a simple piece of functionality to be added into Qlikview.next – it’s not going to set the world alight but it all helps push the functionality that Qlikview can deliver and gives us another tool in the Qlikview Toolbox.
I don’t think this chart is perfect as for instance it can make comparing segments from each ‘floating’ bar harder than it might but then again with most other chart types the breakdown wouldn’t be shown in the first place so I think it’s one to have in the Qlikview armory.
As always; I hope you can put this to use or it helps you deliver something similar.
All the best,