Text-labelled bars: beyond the default

By default, Tableau won’t label a bar. The axis is enough for viewers. However, a lot of our users say to us, “We like the bar, but we want to see the numbers as well“. Rather than reproduce a bar chart as a table, labelling the bars is the obvious way to go. Tableau provides an obvious way to do this, but this viz below shows 3 other ways you can label the bars.

Example one in the above viz is the default – just copy the Measure that’s on the Columns shelf to the Text shelf of the Marks card:

Default text

In Example two, I’ve added Color to the Marks shelf to get a stacked bar chart. By default, the Text marks would now appear in each segment. If you still want the total label visible, you need to add a Reference Line. Right-click on the axis and choose Add Reference Line…

You then need to add a Line with the following settings:

Totals Reference Line

That’s cool – you’ve done some labelling that is outside of Tableau’s default behaviour. What if you want to add some allowable bling to your chart, ie do something visually attractive, but stick to the principles of good visualisation? Well, you can put the text label inside the bar.

The third example, with the white text inside the right-hand edge of the bar, is also acheived with a Reference Line. To do this, create a reference line with the same settings as the previous example.  Now select the Reference Line and choose Format…

Format Reference Line

On the Format panel, set the Reference Line Label Alignment to Left-Align (horizontal) and centrally aligned (vertical). Change the Shading to 0% and the Font to white. Bingo! Your text is now inside the right-hand edge of the bar.

The fourth example, aligning the text at the left-hand edge of the bar, next to the category label, was something of a quest for me after seeing that it can be done relatively simply in Excel. To achieve this, we need to twist some of Tableau’s other functionality to suit our needs!

The first step is to remove the Measure mark from the Columns shelf, and put it onto the Text shelf. Yes, that means we have just created a table, not a chart. Stick with me, we’ll get there. Now put a copy of the same Measure onto the Size shelf. Still looking a bit wacky? Ok, the final step is to change the Mark type from Automatic to Bar:

Left-aligned text in a bar

You should now have your left-aligned labelled bar.

The techniques for examples 3 and 4 can enhance your Tableau charts. There are some restrictions to these two though:

  • They only work on horizontal bars
  • If one value is very low, the label may not appear correctly
  • For the left-aligned text (example 4), it works best with a big range of values.

You may also have noticed that I have hidden the axes on all of the charts above. I believe that if you are going to put text-labels on the bars, it’s bad practice to also show an axis.

To get a better idea of how to do this, download the workbook to see how I built it all up.

Golf score analysis: Scandinavian Open

I like disc golf. It’s the same kind of thing as ball golf, but played with discs (“frisbees”). Instead of holes in the ground, discs are thrown to metal targets. Just like ball golf, there’s a plethora of stats generated. This weekend saw the Scandinavian Open take place in Sweden. This is one of the biggest events in the calendar, and draws the top players from around Europe and the USA. The guys put the scores up promptly, so I thought I’d take their data, and visualise the results.

I created two dashboards using their results:

The Player dashboard

The Hole by hole dashboard

General election 2010

Here in the UK we have just been through (and, at the time of writing, are still enduring) a general election. This presents us with some fantastic datasets. The first place I turn to is the Guardian Data Store, and they provided this, which allowed me to create Election results dashboard below.

I won’t comment much on it, but it does utilise three tricks that I hope to explore and explain in the coming weeks:

  • Hyperlinks on sheets
  • Conditional formatting on tooltips
  • Positioning the text label in the bars

Enjoy the viz, and please post and comments below.


Why start another Tableau blog?

Those who know me from the Tableau forums or Twitter, or the UK Tableau User Group know that I love Tableau.Those that don’t know me: well, I work at the University of Oxford, and have been using Tableau since December 2007.  Since then, I have been raving about it, Ancient Mariner style, to anyone who catches my eye.

It’s been inevitable that I’d set up a blog. What do I hope to add the world of Tableau knowledge?

  • A repository for hints-and-tips on Tableau
    There aren’t many people blogging about basic/advanced Tableau jedi tips. The inspiration for this approach is from blogs such as Daily Dose of Excel – a great place to learn things.
  • A showcase for mine and others’ Tableau Public visualisation
    There are several other great blogs doing this, and I hope this blog adds to the general commentary
  • Occasional discussions of other info viz related matters

I hope to help everyone advance their Tableau knowledge. Along the way, we’ll learn some things that are useful on a day-to-day basis, and some things that you may never need, but could inspire you to think differently about things.

Let me know what you want to see me cover. Are there any beginner/jedi tips not covered in Tableau’s excellent Learning Centre?