10/17/2017
Tableau Tips - 10 tips for Viz in Tooltips (Now Available in Tableau 10.5)
Back in July 2014, I wrote a blog post Tooltip Canvas in Tableau - A Mockup for Chart Functionality within Tooltips based on an idea I added to the Tableau Ideas forum back in April 2013. The basic idea was adding the capability of having a visualization inside of a tooltip. This functionality was demonstrated on stage at the Devs on Stage at the 2015 Tableau Conference. After that conference, I watched beta after beta to see if this functionality had been added. The functionality was mentioned again at the 2016 Tableau Conference, but it wasn't until earlier this year that I saw the feature in an Alpha release. This was very exciting. I was able to work with that Alpha release and try out different features and I knew that the beta release wouldn't be too far behind. Well that day has come. Viz in Tooltips has now been released as part of Tableau 10.5.
#10 - Adding Additional Context to a Viz with Multiple Charts in Tooltip
In this example of a Viz in Tooltip, when hovering over a dot for Illinois on a U.S. map, the tooltip shows the current sales in Illinois, the sales over time in a bar chart, and a map of the sales by city in Illinois with the size of the circle showing the amount of sales and the color encoding the profit for each city.
#9 - Drilldown Capability
In this next example, there is a bar chart showing the quantity by category. On hover, the current quantity is displayed along with the quantity over time in a line chart. In addition, the quantity is also shown by sub-category within each category. This allows a user to see underneath Category, drilling down to the Sub-Category, simply by hovering over a bar.
#8 - See Data Over Time
As in the previous examples, data is shown as a snapshot in time. In this example, there is a dot plot showing Infant Mortality Rate by Region for 2010 and each dot represents a country in that region. On hover, the Viz in Tooltip shows a line chart, removing the 2010 filter, showing the trend of the Infant Mortality Rate for that country from 2000 to 2010.
#7 - Control the Size of the Viz in Tooltips
The size of the tooltip viz can be controlled as well. If the worksheet is set to Standard view then the size will fit up to the maximum width and height based on the size set in the worksheet. If the worksheet is set to Entire view then the tooltip will use the entire dimensions set in the maximum width and height.
If you prefer to have a tall chart in the tooltip then you can set the maxheight taller and the maxwidth narrower. In the example above, the maxwidth is set to 300 for both the line chart and the bar chart, but each have a different maxheight.
Tooltip:
For a wider tooltip, simply change the maxwidth to a larger value.
Tooltip:
#6 - Change the Background Color of the Tooltip
The Viz in Tooltip is created by creating a new Worksheet. Therefore, it's easy to format the tooltip. Simply change the Background color of the Worksheet and the color of the tooltip background will change. There will be a white border around the Worksheet, but this allows for the Viz in Tooltip to match the design and color of the main visualization. Note - in Tableau 10.5 beta 1 the right-hand padding is a bit too wide, but Tableau Support indicated this should be resolved in Beta 2.
#5 - A Viz in Tooltip Hovering Over an Icon (Custom Shapes)
The Viz in Tooltip can be used anywhere a tooltip can be used. This would include the tooltip for an icon, i.e. when using custom shapes in Tableau.
#4 - Add Images to Tooltips
You can't add an image object, but there are two other options that will work well. One method is to use custom shapes. Bring your images in as custom shapes and assign them to your dimension. On hover, the image will show up in the tooltip.
Another option is to assign an object as the background to a scatterplot. Simply create a scatterplot with values of 1 on the columns and rows. Then assign an image to the background. There are a few more steps involved, but it works very well. Let's assume you have a list of dimensions in a worksheet with a shape and you want the tooltip to have an image.
Step 1: Create a scatter plot
Create a new worksheet
Double click Columns and enter 1.
Double click Rows and enter 1.
Put your Dimension on the Details. For example, a person's name.
Double click the Y-Axis and Fix it from 0 to 1.
Double click the X-Axis and Fix it from 0 to 1.
You now have a scatter plot that is ready for an image.
Step 2: Add a Background Image
Select Map from the top menu and then select Background Image.
Pick the data source that you are using.
Select Add Image and pick the image you would like to add using the Browse button.
Set the X-Field Right to 1 and the y-Field Top to 1 (to match the values you entered in the Columns and Rows).
Set the worksheet to Entire View.
Select the Options tab and select Add.
Choose the dimension you want to assign and then pick the value from the list. This will assign the image to only show up on certain values.
Select Add again to assign more images to different values in the Dimension.
Select Ok and Ok.
Step 3: Add this new worksheet into the tooltip of the main sheet.
On the main sheet, select Tooltip from the marks card. Select Insert and pick the name of the new worksheet that you just created (the scatter plot) to insert it into the tooltip. Set the maxwidth and maxheight to the desired size of the image. It should look something like this.
Tooltip:
#3 - Add a Divider Line Between Tooltips
The easy way to do this would be to add a line as text in the tooltip.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Another method is to use a blank sheet as a divider. We will use this technique for another tip as well.
Updated 1/11/2018: Tableau 10.5 was released today. It appears that any value less than maxheight="9" will create a message on the bottom of the tooltip "View is too large to show". You can avoid this error message by using maxheight="9" or higher, but this will create a larger border line.
#2 - Multi-level Tooltip
In this example the Viz in Tooltip is showing two different levels of detail. When hovering over a city on the map, the tooltip shows the sales over time for the State as well as the City. This is done by using two different sheets. The first sheet is modified to filter only "State". The second sheet uses the "All Fields" filter.
Tooltip:
#1 - Change Tooltip via Parameter
Can we change the tooltip viz based on a parameter? Yes we can (with one downside). Here's the steps.
Step 1: Create Worksheets for Each Tooltip
I created three worksheets:
Sales - a line chart to show sales over time
Profit - a diverging bar Chart showing profit by year
Quantity - a bar chart showing the quantity by year
Step 2: Create a new parameter.
I created a string parameter "Pick Tooltip" with three values matching the names of each on of my new worksheets; Sales, Profit, Quantity.
Step 3: Create a Calculated Field
Calculated Field Name: Tooltip
Formula:
Step 4: Build the Tooltip
The calculated field can now be used in the tooltip to show your chart. The problem is that it won't filter to the desired result when you hover over a point. So if you wanted to show all of the data in a chart on hover then this would work well. To get it to filter correctly, simply add the sheet again on the tooltip. You will need to do this for all three sheets that you want to filter. Simply set the maxheight equal to 1 (zero won't work) so that the sheet will not display in the tooltip.
Tooltip:
The one downside that I noted is that when using this method there is a message box at the bottom of the tooltip; "View is too large to show". This shows up in presentation mode as well. It would be ideal for this message to disappear in presentation mode or when publishing to Tableau Public or Tableau Server. While it's important for the designer to have this indicator, I don't think it's helpful to a user of the visualization.
I think you will find this feature incredibly powerful. This single feature opens up so many possibilities, offering deeper insights right in the flow of analysis.
I hope you find this information useful. If you have any questions feel free to email me at Jeff@DataPlusScience.com