This post, and the associated workbook, will show you five ways of adding images to your Tableau dashboards:
- As a shape on a worksheet
- As a shape in a Viz-in-Tooltip
- In a dashboard web object using a URL Action
- As a background image in the view
- As dashboard image objects
A built example of each of these methods can be found in the associated workbook, which you can interact with and download from Tableau Public here. Looking through the workbook is the best way to understand each method used in detail. The below post will give a high-level overview of the steps involved in each method.
Adding Custom Shapes to Tableau
The first two methods make use of custom shapes, so let’s first look at how you add these to Tableau:
- Find or create ideally small/low resolution images that you want to use in your dashboard
- Copy the images from your computer and paste them into a sub-folder within the Shapes folder of your Tableau repository
For these examples, I created a new folder called Christmas as the images are of that theme. This allows me to easily find them within Tableau. If you’ve customised the location of your repository, the path will be different, otherwise it will be the default which is shown in the image below:
These images are now available as shapes in Tableau desktop along with all the other shapes (note, you’ll need to click the Reload Shapes button for your new folder and images to appear if Tableau is already open):
I’m using two simple data sources, each with 3 rows, which I’ll use to assign shapes to and for various dashboard actions:
1. As a Shape on a Worksheet
This method uses the following steps (see the workbook for more details):
- Create a parameter with 3 values. I’m using: Bauble 1, Bauble 2, Bauble 3
- Add the parameter to the view on the Shape shelf
- Assign the relevant custom image to each value of the parameter (you can only assign one at a time to the current parameter value, so change the parameter value then assign the next shape).
- Create a second view with the Picture field on rows and use this with a parameter action to change the value of the parameter
- When the parameter changes, the images changes
2. As a Shape in a Viz-in-Tooltip
The steps used for the method:
- To create the Viz-in-Tooltip worksheet, first put the Picture field on rows
- Set the mark type to Shape
- Add the Picture field to the Shape shelf and assign the relevant custom image to each picture
- Now all three images will show in the view.
- Create a view similar to the previous example with 3 marks in the view using the Circle mark type
- Open the tooltip editor and insert the Viz-in-Tooltip sheet just created
- Now, when you hover over one of the circles, a filter is automatically applied so only one image shows in the Viz-in-Tooltip:
3. In a Web Object using a URL Action
Steps used for this method:
- Upload your images to a hosting service such as imgur.com
- Copy the URLs for the hosted images and put them into your data source as a URL field
- Create the same view as before with three circles
- Add the URL field to the Detail shelf
- Add this view to a dashboard
- Add a Web Object to the dashboard (leave the URL blank)
- Create a URL dashboard action and pass the URL field to the Web Object
When you hover over each circle, the URL for the Web Object updates and a new image is loaded.
From a performance perspective, I’ve found this method works very well and images load quickly.
4. As a Background Image in the View
This method is less well know but can work really well in certain situations. One business use case is for visualising data on top of a floor plan images, which you can change to show different floors of a building for example.
Update: for a walkthrough of how to visualise data on floor plans using background images and filters, see this blog post.
For this example, we’ll stay with the Christmas theme and will be using a parameter calculation instead of a filter:
- As before, create a simple view with three circles using the Picture field (I’m using the second data set with three tree images this time). This will be used to pass the Picture value to a parameter using a parameter action.
- Create a second view with X on Columns and Y on Rows – these values are used to position the background image
- Create a parameter based on the Picture field so it has three values
- Create a calculation called Background that equals the value of the parameter and place this on the Detail shelf
- Go to Map > Background Images and select the data source used in the view (Trees in the case)
6. Click Add Image… and browse to the image you want to use and assign the values 0 and 1 to the fields X and Y as shown below.
7. Click the Options tab then click Add… to add a condition:
8. In the popup dialog select the Background calculated field that was added to the view earlier:
9. When you select the field, you will then be prompted to select a value that is present in that field. The background image will then only show when the field has this value. Because this field is taking the value of the parameter, only one value will be shown – the current parameter value (White Tree in this case):
10. Click OK on the dialogs to get back to the view. Then fix the X and Y axes to go from 0 to 1. This will ensure the image fills the view.
11. Change the parameter value, then follow the same steps above to add the other two images, with the relevant conditions. You’ll then have three Background Images, each with a different condition:
Now when you hover over the three circles, the parameter value is updated, this changes the value in the calculation and that determines which background image is shown:
5. As dashboard image objects
The final method is the easiest of all and simply involves dragging Image objects into the dashboard from the side panel:
When your drag one of these to the dashboard, a popup window appears for you to browse to the image file to show in the image object:
You can then resize the image object and add borders as needed, just like other dashboard objects. In the example below I have one large image object with three smaller image objects floating on top:
Again, I’d recommend exploring the associated workbook for this post to look through all the dashboard actions involved and other settings. Each method has its benefits depending on the situation and the desired effect.
The main advice I would offer is to make sure your images are small in size to ensure a quick load time. I’ve found the URL action method with a Web Object is very quick, though it’s not suitable for all use cases. As an example of where I’ve used this method, below is a section of a visualisation of a travel map I made recently, where you can hover over a point on the map and show a photograph of that location:
Thanks for reading!