Data Viz Done Right

February 21, 2015

Tableau Tip: Labeling the Right-inside of a Bar Chart

15 comments
I'm currently in the middle of peer reviewing Cole Nussbaumer's new book. One of the things I appreciate most about Cole is her focus on simplicity in design, particularly when it comes to bar charts. Here's a typical example of her simple design style:


This got me thinking. Out of the box, you cannot put the data label for bar charts in Tableau on the right-inside of the bar. Here are the options you get from the Labels shelf:








None of these options let me label the bars like Cole does. To do so, you need to follow a few simple steps:












That gets you the same look as Cole, and if you want to take it one step farther, you can clean it up even more by moving the dimension labels inside the bars on the left. Of course, this would only work if the bars are big enough.


You can download the workbook used to build this example here (requires Tableau 9).

UPDATE: Joe Mako suggested in the comments to use a cell-level reference line. This method saves the secondary axis for something else, should you need it. Both methods solve the same problem though. I've included this method in the workbook link above. Here's what it looks like:


And if you want the dimension labels inside the bar as well, simply drag the dimension to the Label shelf and left align.


15 comments :

  1. Would you say labeling bars like this is something that should be used more often?

    ReplyDelete
    Replies
    1. I really like the look this way. Feels cleaner. The problem is it really only works well when all of the bars are big enough to fit the label. So, use with care.

      Delete
  2. If you want to save the dual axis for something else, you can get the same effect with a Cell Reference Line, left aligned, with shading off and no line.

    ReplyDelete
    Replies
    1. Ahh good one Joe! Gantt was the first thing that came to mind. Again, this shows there are multiple ways to accomplish the same thing in Tableau. I hope that one day we have more finite control over layout elements like this.

      Delete
  3. Lovely tips. It's like 2010 all over again!!
    http://interworks.co.uk/andy-cotgreave/text-label-beyond-default/
    :-)

    ReplyDelete
  4. Good one Andy!!! I suppose I should have searched Google first.

    ReplyDelete
  5. Do you know of a way of putting the labels outside the base of the bar. That way the numbers are nicely vertically aligned and there are no problems with displaying long labels. I am aware that you can make the measure discrete and put in on the row header, but what would you do if there were multiple columns with bars in them...

    ReplyDelete
    Replies
    1. Do you mean left aligned under the bar?

      Delete
  6. What I am after is a way of constructing graphic tables in Tableau.

    In this example, the budget deviance labels are placed left of the waterfall bars. So pretending they were just bars, is there a way of placing the labels that way so you can keep everytning with a table structure with sorting options, easy vertical scanning of numbers etc.?

    http://blog.bissantz.com/graphic-tables

    Or, put in other words, in your example http://vizwiz.blogspot.dk/2015/08/barsanddots.html, could you put the labels to the left of their respective bars and dots (I wish to avoid the overlapping the bars/dots)?

    ReplyDelete
    Replies
    1. There are definitely way you can do it. One way off the top of my head, is to create a calc field that AVG(0). Then place that on the shelf you want it on and add your value to the text shelf.

      Delete
    2. Yes, that would work. Unfortunately, there is no way of varying individual column width (to my knowledge) - but that's sort of a different issue.
      Thanks.

      Delete
  7. I followed this exactly, and I really like how clean these graphs look. However, I have them in a dashboard as part of an action, and when I select a bar the Value label on the right disappears. Is there a way around this, or am I doing something wrong?

    ReplyDelete
    Replies
    1. Unfortunately, not that I can think of off the top of my head.

      Delete
  8. I'm having a hard time figuring out how to get the label inside the bar on the left side. Do you have more specific instructions on this? Thanks!

    ReplyDelete
    Replies
    1. You can use this same technique but instead, add a gantt bar on the dual axis with the value of 0 and label it with the value of the other bar. Or you can simply left align the label on the bar I believe without doing a reference line or dual axis.

      Delete