3/8/2017
Tableau Tips - Volume 9 "10 Tips from a Makeover Monday Viz"


This installment of Tableau Tips focuses on tips used in creating my Makeover Monday viz from Week 9. Below is the finished viz. You can view and download the workbook from Tableau Public here




There are a number of tips from previous posts that I used in this viz, but in this volume of tips I wanted to highlight some new tips.


#10 - Creating Date Parameter with Formatting


Everything in this viz is controlled by a slider control for the date. A filter won't work because we don't want to filter months from the data, we simply want to highlight them. Also, the built-in highlighter functionality in Tableau doesn't offer the slider control and formatting options that I'll demonstrate below. So the first step is to create a parameter based on the date field in the data.

Note the settings used here. The range of values is taken from the range of the data. The step size is set to "1 month" and the formatting is set to "December, 2016", which will be used in the viz.




#9 - Parameter in Text Box


Using parameters in a text box or as titles can make them dynamic. In this case, as the user moves the slider, the text box updates to the selected month. The format was set in the previous tip, so this is the format that appears in the text box. Select "insert" from the text box menu and select the parameter that you created.




#8 - Using Parameter to Highlight Data


This tip, combined with Tip #7 and #6, highlights the data when the user moves the slider. We have to tie our new parameter that we created to a calculated filed in order to highlight our data in the viz. This is a very simple boolean calculation. In this data set there is only one year of data (2016), so I used the month function of the parameter equal to the month of the data field. This could be any field though. For example, a list of states in the parameter matching the state field in the data. It will be true when it matches and false when it doesn't match.

   Calculated Field: Highlight Color
   Formula: month([Date Slider]) = month([Date])



Place the boolean field on the color shelf and set the colors for true and false and you can now highlight your data using whatever color combination you want.

#7 - Dual Axis Chart to Highlight


If I just wanted the bars on the bar chart to be a different color then Tip #8 would be enough, but I wanted something a bit more stylized than just the two colors. By creating a dual axis bar chart, I can use separate marks cards which allows more formatting options. I created a new calculated field that would Sum(Amount) when the Highlight Color is true, otherwise it's null.

   Calculated Field: Amount right-side label
   Formula: IF [Highlight Color] THEN [Amount] ELSE null END



Place this new pill on the Rows next to SUM(Amount). There are now two bar charts. One showing the entire year and the other showing the selected month from the parameter selection.




Right-click on the new pill on the Rows and select "Dual Axis". The charts are now on top of each other.



Another advantage of having the dual axis with two different pills is that you can format the y-axis labels differently. This is a tip (Tip #6) I outlined previously from Tableau Tips Volume 2 here. Formatting the left y-axis labels to the same color as the background makes it "disappear".

#6 - Create Outline of Bar using Borders


I wanted to have a red outline on the selected bar. Since Tip #7 creates two marks cards by using a dual axis, there is now more formatting flexibility. The bars on the first marks card can be normal bars with no border and the secondary axis bar can have borders. On the second marks card, select color and set the border to red.




#5 - Using Unicode Character as Indicator Arrow


Now that the highlighted bar is a different color and has a red border around it, I decided to add a simple indicator icon on top of it. I've posted a number of tips on using Unicode characters (See Tableau Tips Volume 4 here, Tableau Tips Volume 5 here and Tableau Tips Volume 8 herefor more tips on Unicode characters). In this example, I created a new calculated field using the Highlight Color calculated field created in Tip #8.


   Calculated Field: Indicator Arrow
   Formula: IF [Highlight Color] THEN '▼' ELSE null END



Add this field to the label of the secondary marks card, change the color of the label to red and set the size to the desired size. We now have an indicator icon that will display on top of the highlighted bar and change based on the parameter selection. You could use any Unicode character here and they can be used anywhere text is used.




#4 - Tooltip with Different Color Labels


Creating a stylized tooltip is a great way to add contextual detail to your visualization. More specifically, I wanted to have the amount shown in the tooltip match the colors used in the bars. I wanted the tooltips over the dark bars to have the amounts in dark text and the tooltip over the highlighted bar show the amount in red.




The tooltip on the non-selected bars matches the color of the bars.



The amount shown in the tooltip on the selected bars is red.



#3 -Axis Ruler as Divider


There are a number of ways to create thin lines on a dashboard. One method is Tip #2 shown in Tableau Tips Volume 2 here. In this case, I wanted a vertical line separating the text box label from the amount in the middle section of the viz. Since the amount is a chart, I utilized the axis rulers to create the divider. By adding an axis ruler to the rows, a thin like is added in between the text box and the amount.




This creates a simple divide without cluttering the dashboard with borders around everything.




#2 - 3D Text Using Floating Text Boxes


This is a fun one. I wanted to add Andy's name to the credit card used in the image, as if it were raised text on a credit card. One option would be to modify the image in Adobe Photoshop adding some 3D text to the image. This is a common technique when we want to use custom fonts on our Tableau Public work, since there are only a few fonts supported. I decided to try something new, creating a raised text look by using floating tiles on top of each other.

First, create a text box with the word(s), set the color to a lighter color and place it on the dashboard as a floating tile.



Second, create an identical text box with the same word(s), set the color to a darker color and place it on the dashboard as a floating tile. Use the layout tab to adjust the X and Y position to be slightly offset from the first floating text box.




Once offset to the right amount it will have the appearance of raised text. Also, since they are both floating objects, they will move together on the dashboard as positions are shifted slightly on various devices, so the effect should work well on different displays.



#1 - Axis Title for Blue Pill Date


In some of these screenshots you may have noticed that the x-axis has a single month letter with the year underneath it. The year is an axis title, but this doesn't show up for blue pills (discrete dates), which is what is being used for this date field. So how do we get an axis title on a discrete date pill like this? The trick to this one is to start with a green pill and change the title. Let's walk through the steps on this one.

First, drag a date field to Columns. This will start as Year(Date) by default. Right-click on the date and change it to "Exact Date". You will now have a Green Pill (continuos date) with a title and subtitle showing. If you modify the title and subtitle then they will remain when you change the pill back to a blue pill. I changed the title to 2016 and unchecked the automatic subtitles so it would be blank. Next, set the data format back to DATEPART('month', [Date]). This is the first "month" listed in the formatting options when you right-click on the date pill and it will automatically set it back to a blue pill. Finally, I formatted the month to a single letter month for a clean design.

click on the image below to enlarge




I hope you find these tips helpful. If you have any questions feel free to email me at Jeff@DataPlusScience.com

Jeffrey A. Shaffer
Follow on Twitter @HighVizAbility