Have you ever had the need to have color legends for your charts?

Color legends are very useful for being able to tell exactly what a color references inside of a chart but it takes up a lot of real estate on a dashboard that could be used for other purposes.

In my current example, I have a dashboard with two charts, two sets of color legends, and two crosstabs with sales totals of the same dimensions in the color legends.

In this post, I will show how Tableau can consolidate two sets of information (color legend and totals crosstab) into one space efficient chart.

First, I will open up my region totals crosstab. Then I am going to change my chart type to a bar chart using the dropdown located within the marks card. This will convert my crosstab but leave my total sales on the text.

Next, I will place my Sales dimension onto the size shelf.

This will cause my bars to start looking like a bar chart. To get the bars to push from one end of my chart to another, I will double click the Size legend (located below the marks card), select “By range” from the drop down on the right side of the size window, and slide the mark size range slider to the largest size allowed.

Now take the Region dimension and drag it onto the Color button. By now your worksheet should look a little something like this:

Last, in order to make the numbers not look like they are getting cut off on the right side, I am going to right click one of the totals, select format, click the alignment button on the left side, and change the default pane alignment to a center alignment.

After doing to same steps with my Supplier crosstab and taking out those now redundant color legends, my dashboard will look cleaner and have a lot more space for me to other useful charts.

Side note: if you ever experience the totals disappearing during the creation of these charts, simply drag off the label and place it back on again.

Thanks for reading and if you have any questions, comments, or just plain feedback, please use the comments section below.


Thanks Matthew -- this is a great tip. Really cleans up the chart, I like how much information is conveyed with the combination bar/legend -- I'm looking forward to using this!

Great idea! Looks awesome. Anything that helps maximize dashboard real estate is a valuable tip.

This is pretty nice. Tableau is about tricks & tricks. I am going to use it today itself.

What about background colours for different expressions based on different conditions ?

Sales measure - > red if sales < 5000 and green above >5000
profit -> less than 0 red and green if greater than 0.

What you speak of is a KPI. The calculation for Sales would look like this:
if SUM([Sales]) >= 5000 then "green"

Replace the Supplier dimension in the color shelf with the new calculation and adjust the color legend to red and green.
Reference Example 4: Create Virtual Bins: http://kb.tableausoftware.com/articles/knowledgebase/understanding-logical-calculations

What about background colours for different expressions based on different conditions ?

Sales measure - > red if sales < 5000 and green above >5000
profit -> less than 0 red and green if greater than 0.

I think you should go one step further and make that regions list sorted by Sum(Sales) in descending order.
You can see such a colored ordered legend in WSJ charts prety often.
This technique is not just about dashboard real estate but a good practice from visual perception perspective.
And it's even more important for the second chart than for the first one with the map and just 4 items in the list.
But from Tableau user experience perspective it might be a bit confusing if your legend doesn't support standard filtering functionality.

Really useful !


There's a cool site called http://adult4sexchat.com that has chat rooms. I'll tell some people in there about your article.

Abonnieren Sie unser Blog