How to Create Custom Visual (Colors) for Bullet Charts in Tableau – 2 Simple Methods
Blog | January 13, 2019 | By Vijai Narasimha
Tableau is flooded with great visualization(s) that users can bank when preparing a dashboard that helps bring their data to life. These range across your infamous bar chart/bar graph and pie chart, to your not-so-common donut chart, stacked bar chart, bubble chart, etc.
More users create bullet charts, considering it is one of the best charts to gauge the progress of a metric with respect to an existing standard. It is widely used across domains ranging from Retail to Finance and even Marketing. Extremely helpful to measure a qualitative range, every company uses this chart for different data representations.
The bullet chart / bullet graph was introduced by the data visualization pioneer Stephen Few. It was created to overcome some of the older visualization techniques and charts like Gauges, Speedometers, and Thermometers. In the era of modern data visualization, Business Intelligence provides faster insights into data without complex codes or calculations behind the scenes. One such immensely popular chart is Bullet Chart.
What is a Tableau Bullet Chart or Tableau Bullet Graph?
In many ways, the Bullet chart is an improvised version of a Bar in Bar chart. Bar in Bar chart, though a fantastic chart on its own, does not provide all the required details for comparison against a threshold – making it a lot more challenging to cross-reference a calculated field against the other. However, the Bullet chart has some special features which make it so powerful. Tableau comes packed with features that allow us to create both Bar in Bar chart (discussed in some other blogs) and very colorful Bullet Charts.
For more details on the Bullet chart, we can read the Bullet Chart Specification article by Perceptual edge.
There are many features of a Bullet Chart that stand out, a few are mentioned here:
a) Bullet chart is always represented on a Liner Quantitative scale with axis marks. Gauges and Speedometers are plotted on angular scales which make it a little difficult to read and measure value.
b) A bullet chart usually has 2 measures. One main measure is the measure/metric in consideration. The other measure acts as the Threshold or Standard against which the main measure is compared.
c) The Main measure is represented in Foreground and the Threshold measure is represented in the Background which makes it easy for comparison.
d) The Threshold measure is split into multiple ranges with a color gradient (Percentage or Percentile) which helps in monitoring the growth of the main measure as data improves.
In this blog, we will discuss two different methods to customize the color palettes for the Bullet chart in Tableau
There are many blogs that provide steps to build a Bullet Chart on Tableau. But this blog aims at creating a Bullet Chart with customized color segments for the defined ranges. The reason to create custom ranges is to suit end-user requirements. We have about 15 default color palettes in Tableau for the Bullet chart with many repetitions. Most developers stick to Gray or Blue Gradient or the Traffic Stoplight. But end-users from different teams might need different color sets to show the percentage of percentile thresholds.
For the first method, we will create a new color palette in the Preferences file. Then we will discuss all the steps to create a Bullet chart. For the second method, we will create an Alternate version of the Bullet chart.
For this blog, we will be using a very simple dataset. The same data was used in some other blogs.
This data has an Actual measure that will be used on the Foreground and a Forecast measure which will be used as the threshold on the Background. For the Bullet chart feature, we will be using three threshold ranges 50%, 75%, and 100% of Forecast.
After going through iterations and multiple rounds of discussions about color blind features and best practices with other analysts, we have narrowed it down to three colors – Light Blue (50% and lower), Light Gray (50% – 75%), and Light Orange (75% – 100%) on the background and Dark Gray on the Foreground for contrast.
Method 1 – Create Custom Color for Bullet Charts in Tableau
In this method, we will discuss creating a Custom Visual Color Palette and using it in a well-defined Bullet chart that Tableau offers. We will discuss all the steps needed for this method.
1) The first step would be to create the required Color palette in the Preferences file. The Preferences.tps file will be found in My Tableau Repository under Documents. This is where all the default files required for Tableau are stored. The Preferences.tps is an XML file. It can be opened in any text editor. We just need to add our Color Palette code to it.
Once the changes are saved, when Tableau is reopened, we can see this new Palette ready for use. Sometimes, it might take a complete PC restart.
In Tableau, we have the data ready, we need to build the Bullet Chart. We can use SHOW ME which has a ready Bullet chart. It might need some tweaks. But we will build using steps and use some Best Practices.
2) Use the Actual measure on Columns because it will be on the front. Slice and Dice using the Name dimension. Making the bar thinner and dark gray color.
3) Next, we need to bring the Forecast measure. This measure cannot be directly used on Columns or Rows. Since it has come on the background, it should be treated as a hidden measure. IT must be placed on the Marks shelf, either on the Detail card or Tooltip because every other card will change the features of the visualization.
4) Next, we need to create a Reference Distribution from the Analytics pane with the following features.
- Per Cell with the Forecast (background) measure
- Without Labels
- Fill the Below color with the custom palette.
In this case, the reverse is selected since the order is left to right from the Preferences file.
5) This step is optional. Many people prefer this step to clearly show a 100% threshold. So, we need a Reference Line with the following features.
- With Line
With the current situation, this view is created.
The only drawback of a Bullet Chart in Tableau is the absence of the option to show a color legend. After some cosmetic changes like line formatting, color formatting, etc., we arrive at the final view.
Method 2 – Create Custom Color for Bullet Charts in Tableau
In this method, we will discuss the manual steps to create a Bullet chart without making changes/ addition to the Preferences.tps file. This method might be a little tedious, but it comes in handy for many other tricks. Also, it would be very difficult to edit the Preferences file every time a change is requested by the end user.
In this method, we use the idea of layering multiple reference lines with filled colors.
It will look like 3 bar charts placed one on top of the other. Then, the Actual measure will be in the foreground.
1) The first step would be to start with a bar chart of Actual measure and Name dimension.
2) Next, we need to bring the Forecast measure. As our plan is to layer 3 pieces, we need 3 individual measures. One for 100% of Forecast, one for 75% of Forecast, and the last one would be 50% of Forecast. Since 100% of the Forecast is ready, we don’t have to create it.
3) All 3 measures on the Detail Card of Marks Shelf.
Next, we need to create 3 Reference Lines in the 100%, 75%, and 50% order.
4) 100% Reference Line with the following features
- Per Cell
- With Line
- Fill Below color – first color (In this case Orange)
5) Repeating the step for 75% Reference Line with the following features
- Without Line
- Fill Below color – second color (In this case Gray)
6) Repeating the step for 50% Reference Line with the following features
- Fill Below color – third color (In this case Blue)
With the current situation, this view is created.
After some formatting changes and creating legends, we arrive at the final view.