VizWiz

Launch, grow, and unlock your career in data

April 12, 2014

Tableau Tip: Moving reference lines behind bars

3 comments

Reference lines are wonderful. If done well, they can add so much context at a glance with very little effort to include them in your viz. However, reference lines in Tableau always sit on top of the rest of the viz. We may not want them to be so prominent though.

Wouldn't it be great if we could place them behind the bar, kind of like how you can decide which objects to move backwards on a PowerPoint slide?

First, let's build a simple bar chart of Sales with a reference line for Budget Sales.

2014-04-12_00-30-50

If we click on one of the reference lines and then right-click, we don't have an option to move the marks to the back.

2014-04-12_00-35-43

There's a super simple trick to move the reference lines to the back...Gantt bars!

Step 1: Move Budget Sales from the Detail shelf to the secondary axis of the chart.

2014-04-12_00-43-00

Tableau will change the marks for both axes to circles.

2014-04-12_00-45-16

Step 2: Right-click on the Budget Sales axis and choose Synchronize Axis.

Step 3: On the Marks card, click on All and drag Measure Names off of the color shelf.

2014-04-12_00-48-49

You should now have only blue circles like this:

2014-04-12_00-51-33

Step 4: Click on SUM(Sales) on the Marks card and change the Mark Type to Bar.

2014-04-12_00-55-17

Step 5: Click on SUM(Budget Sales) on the Marks card and change the Mark Type to Gantt Bar. But now it looks like the bars disappeared, so we have to make a couple other adjustments. We can’t see them because they’re blue and the same width as the bars for Sales.

Step 6: On the Size shelf, change the size of the Gantt Bars to the maximum size. This will make them the width of each cell.

2014-04-12_00-57-17

Step 7: Click on the Color shelf and make the bars black.

2014-04-12_01-00-32

Step 8: Right-click on the Budget Sales axis and choose Move Marks to Back.

2014-04-12_01-01-38

The "reference lines" are now behind the bars.

2014-04-12_01-03-05

Step 9: The final step is to right-click on the Budget Sales axis and uncheck Show Header.

2014-04-12_01-05-24

Download the workbook here.
 

 
Note: This is my first blog post using Tableau for Mac. I've been testing the alpha since January and am happy that it's getting to the point where I feel comfortable using it first.

3 comments :

  1. The workbook you posted cannot be opened by Tableau 8.1 for the lowly Windows user ;) Just upgraded to Tableau 8.1.6 (Windows), the latest Desktop version that fixes the Heartbleed vulnerability. I suspect it is because you created the workbook using Tableau for Mac. Glad to hear that the Mac version is coming along so well.

    -Steve Mayer

    ReplyDelete
  2. Steve, you should be able to open the workbook with the 8.2 beta.

    ReplyDelete
  3. Andy- I LOVE this tip! I had one data item to show and wanted the average for all of the categories being shown, so it was a smidge different than your example. I used the windows_avg to create a calculated field, which became the second data item/reference line and followed the rest of steps and it was like tableau magic! Awesome!

    ReplyDelete