Raising the bar - Customising Tableau bar charts
On Monday 12th February 2018 I was fortunate enough to have my 'Need for speed' #WinterGamesViz selected as the Tableau Public Viz Of The Day. The viz analysed the top speeds reached by Winter Olympic athletes across a range of winter sports and compared these with some well known Summer Olympic sport speeds, such as the 100 metres or road cycling.
Within the viz I included a bar chart that visualised the different speeds and I customised this create the appearance of 'speed' by changing the ends of the bar chart to become slopes. Since I published the viz a lot of people have got in touch to comment on the creativity of the bar chart and how it isn't something they have seen done in Tableau before. Here is how I did it, be warned the actual solution may surprise you as it is pretty simple!
1. Create a 'zero' Measure
If you wish for both ends of your bar chart to be adapted you will need to create a 0 Measure; this will allow Tableau to plot a data point at the beginning of your bar.
2. Add your Dimension and chosen Measure to the worksheet
Your viz will start off as a standard bar chart, with a single Dimension in Rows and a single Measure in Columns. For the purpose of my #WinterSportsViz I selected Event as the Dimension and Average Speed as the Measure and sorted the Event Dimension by descending Average Speed.
3. Changing your bar chart to be dual axis, using Measure Values as the secondary Measure
This is where the viz wizardry comes into play. You have already created a standard bar chart that has one bar per Event and has 'flat' ends. You next need to get Tableau to plot an additional data point at the start and end of your bar. This will allow you to change the Marks Card to Shape which is how you will adapt the shape at the end of your bars.
Add Measure Names to Filters and select the 2 Measures; the 'zero' Measure and the Measure you used for step 2, in my example, Average Speed. Having filtered Measure Names add Measure Values to Columns and change the secondary Measure to become a 'Dual Axis' (you do this by right clicking Measure Values once you have added it to Columns and ticking the 'Dual Axis' option.
4. Synchronise your Dual Axis and hide the top header
When creating a Dual Axis bar chart you need to ensure the 2 axis are synchronised; this is important as it will ensure the shapes you add to the ends of your bar chart are correctly aligned to the start and end of the bar.
To synchronise the Dual Axis right click on either header in your worksheet and tick 'Synchronise Axis'. Next you will need to hide one of the 2 headers, to do this right click on the header you wish to hide and untick 'Show Header'.
5. Creating your custom shapes at the end of the bars
I wanted to create the illusion of speed in my viz and as such I chose to 'slope' the end of the bars. To do this you will need to change the Marks Card to be set to Shape for the Measure Values and add Measure Names onto the Shapes Mark.
You will need to set different shapes for each of the 2 Measure Names. The 'zero' Measure should be set to a solid down arrow and the other Measure, in my example Average Speed, should be set to a solid up arrow.
Next you should set the colour of the Shape Marks Card to white (assuming white is the background colour of your worksheet, if not select whatever colour your Worksheet background is set to).
You should now have a bar chart that has the illusion of 'sloping forward'; replicating the forward motion of speed.
6. Amending the Shape and Colour combination to create different bar chart adaptations
Within my viz I chose to display a sloping bar chart, it is however possible to use different combinations of Shape and Colour to change the bar chart adaptation, here are a few combinations that may be useful to you:
To create the appearance of an arror at the start and end of your bar chart you will need to change the 'zero' Measure to a right pointing solid triangle and your visualised Measure to a solid diamond. An additional step is required in this example; add Measure Names to the colour of the Shape Marks card as the 'zero' Measure will be set to white and the visualised Measure will be set to the colour of your bar. You may need to adjust the size slightly of the Shape to match the bar but with a bit of tweaking your bar chart should end up looking like this:
A round ended bar chart is simpler to create. You can remove the 'zero' Measure from the visualisation and only have the visualised Measure showing on the secondary axis. There is no need to apply any Dimension to the Shape Marks Card, simply select a filled circle as the Shape and set the colour to the same as the bar. Again you may need to amend the size of the bar or Shape but once you have done so you should end up with a visualisation looking as follows:
Whilst this tutorial is not the most technically advanced, I still hope you found useful and you will be able to apply it in one of your future visualisations. If you wanted to check our my full Viz Of The Day visualisation the link is below: