How to Add Colors to Bar Chart in Tableau

When I was creating a sales dashboard for Tableau, the sales team told me the charts looked plain and were difficult to read. The numbers and sales figures were there on the chart, but it was difficult to figure out the different measures.

As a solution, I added colors to the bar charts. By adding colors to the bars, it was easy to highlight important information, such as the top-performing category or regions with low sales.

In this Tableau tutorial, I will explain the various methods to add colors to a bar chart in Tableau.

Add Colors to Bar Charts in Tableau

In Tableau, there are multiple methods to add color in bar charts according to the specific requirements. In the examples that follow, we will discuss the methods for coloring bar charts in Tableau.

  • Add colors to bar charts in Tableau with the color shelf
  • Add color to only one bar in a Tableau bar chart
  • Add shaded colors in the Tableau bar chart

Add Colors to Bar Charts in Tableau With Color Shelf

The first option for easily adding colors to a Tableau bar chart is to use the color shelf directly.

In the chart below, we will use the Tableau superstore dataset to create the view, and then we will add colors to it.

Now, connect the Tableau with the superstore dataset and follow the steps below to add colors to bars in the Tableau chart using the color shelf.

To create the view, add a measure, such as Sales, to the Rows and dimensions, such as Region, to the Columns.

Add Color to Tableau Bar Chart

Now, there are three scenarios to add colors to the bars: adding color for the same bar dimension, adding color to different dimensions, and using a measure to color the dimension bars.

  • Adding color for the same bar dimension: For example, if the dimension is Region and we add Region to the Color card, then all bars will be displayed in different colors.
How to change bar colors in Tableau
  • If we use a dimension different from the one we used in Columns, it will create a stacked bar chart. For example, in the chart dimension is region, and you add a Category to the color card, then the category color will be stacked in each region bar.
Change Color in Tableau charts
  • If we add measures such as sales or profit, then the bar colors will be in shades as shown in the steps below.
How to change colors in Tableau bar chart

To get more color options, click Color -> Edit Color -> Select Color Palette. Then select another color palette and click OK. Now, we can select colors from the newly assigned color palette.

Change Color For bars in Tableau Charts

This way, we can add or change the color in the Tableau bar chart using the Color shelf.

Add Color to Only One Bar in a Tableau Bar Chart

In this example, we will see how we can add color to only one chart in the Tableau bar chart using a calculated field. In the calculation, we will add a condition that will display a different color for one bar in the bar chart.

In the steps below, we will use the Tableau Superstore dataset to create the bar chart.

Add the Sales to the Rows and Region to the Columns to create the bar chart view.

Now, create a calculated field using the formula below. This will display a different color for the bar when the region is “East“.

IF [Region]= 'East' THEN 'Green' ELSE 'Grey' END

Drag the calculated field to the color card, then it will show the East region bar as “Green” and the rest of the bars as “Grey” color.

Add color to one bar in Tableau bar chart

In the same way, we can also use measures to define a condition that changes color for only one bar in a Tableau bar chart. For example, we want to display the region with the highest sales in a different color, so we can use the formula below.

IF RANK(SUM([Sales]))=1 THEN "Green" ELSE "Grey" END

Now, drag the calculated field to the Color card in the Marks section.

Formula to change color of bar chart in Tableau

With this, we can see that the region with the highest sales rank is displayed in a different color from the other bars.

This way, we can add or change the color for only one bar in the Tableau bar chart by using the above formula conditions.

Add Shaded Colors in Tableau Bar Chart

In this method of adding color to the Tableau bar chart, we can show the stacked dimensions on the bars in a shaded color. This is an alternative to a stacked bar chart where each dimension is displayed in a different color.

Now, drag the Sales to Rows and Region to the Columns to create a Bar chart.

Tableau Bar chart in color Shades

To add the color, drag the Region to the Color. This will give a different color to each bar in the chart.

How to add shaded colors in Tableau bar chart

To add the color shades, we need another dimension that will be stacked in each bar. Unlike a stacked bar chart, we will add a dimension, such as Category, to the detail card, then change its type to Color.

Add levels of color in Tableau bar chart

Now, we can see the bars with shaded colors in the bar chart. These shades are the stacked dimensions of the Category. This chart displays sales of categories in each region, with each shade representing a category.

Color Tableau Bar Chart

This way, we can add shaded colors in a Tableau bar chart by following the above steps.

Conclusion

In this Tableau tutorial, we have learned different ways to add colors to bar charts in Tableau. In the above methods, we learned how to use the Color shelf for coloring bars, how to highlight only one bar with a calculated field, and how to apply shaded colors for more detailed analysis.

By using the above methods, we can simplify the bar charts visually and highlight the key measures and dimensions in the Tableau bar chart.

You may also like to read:

Agentforce in Salesforce

DOWNLOAD FREE AGENTFORCE EBOOK

Start with AgentForce in Salesforce. Create your first agent and deploy to your Salesforce Org.

Salesforce flows complete guide

FREE SALESFORCE FLOW EBOOK

Learn how to work with flows in Salesforce with 5 different real time examples.