3 Great Ways to Use Custom Shapes in Tableau
To find out more about Concentra's bespoke Analytics Services and Solutions see Services.
In this blog post, I will take you through 3 different use cases for customised shapes, while showing how I built my example dashboard "Marvel Film Analysis", that you can find at the end of the post.
To customise shapes in Tableau, the first thing you need to do is to save the images you want to use in the folder where Tableau store shape files by default: Documents > My Tableau Repository > Shapes.
After the pictures you want are in the repository, you can begin to use them in your dashboards.
1 - How to Use shapes as marks
Using shapes as marks is the intended purpose for Custom Shapes within Tableau, and it allows you to use an identifier other than colour or a label.
To do it, drag and drop your preferred dimension onto the Shapes option on the Marks Card. This will allow you to use custom images as points on a scatter plot or as marks in an infographic.
In my example, I have used custom marks in a scatter plot as my points on the graph. I have also used custom marks as an "Infographic" to show the ratings for each of the films using the logo from the review websites.
I decided to customise my shapes according to the film franchises they occur in so that films could be easily identifiable by their look. To do this, I dragged "Franchise" onto Shape on the Marks Card.
The next step was to assign the shapes to their corresponding data item. To do this, I double-clicked on shapes to open the "Edit Shape" window. Here I navigated to the folder in the "My Tableau Repository" and assigned each image to its data item. If the folder or shapes do not appear at first, click "Reload Shapes" to refresh the images in Tableau.
After selecting the shapes, I clicked "Apply", then "OK", and my new shapes were then visible on the chart.
2 - how to Use shapes as Buttons
Tableau doesn't offer an inbuilt button functionality to perform tasks such as Filter, Highlight or Change Sheet, but we can achieve these through the use of Custom Shapes. Unlike Custom Marks, this is a workaround and not the intended function of shapes in Tableau, which means we have to do quite a few things to configure them correctly.
In my example, I have used the same custom shapes as my marks, only this time I used them as buttons to filter my scatter plot. I have also used arrows as page turners to navigate between my dashboards.
To use buttons as filters, add your desired filter onto the columns shelf. To filter by Franchise in my example, I moved that dimension onto columns, as can be seen below.
To add shapes to the Franchise filter, I changed the mark type to "Shape" then put the desired filter on "Shape" in the marks card.
Although these are clickable, for them to filter data I needed to apply dashboard actions first. The dashboard actions can be found in the dashboard dropdown under Actions, where you can add Filter, Highlight and URL actions to your dashboard.
I have decided on the Highlight action and chose to activate it only when the mark is selected. I have also chosen which sheets will be affected (Target Sheets), and where the action will originate from (Source Sheets).
You can see the results below.
Figure 8. Buttons highlighting marks
3 - HOW TO Use shapes as Filterable/Dynamic images
Tableau comes with the option to include images and even web pages in your dashboard. These images are not dynamic, and the web pages come with a few drawbacks (the need for an internet connection is a big one). To get around this, we can use custom shapes to become our dynamic and filterable images.
In my example, I have used the movie cover as my custom image, allowing me to select "Film" for the movie cover to be displayed dynamically.
Here is how I did it:
As I was going to use different shapes for this part of my dashboard, I created a separate folder in "My Tableau Repository" for my images. Very similarly to the button, I needed to add a data item for each of my shapes.
After I had a shape for each film, I dragged and dropped "Film" to the rows shelf. To add the movie covers to each correspondent film, I selected shape as my mark type then dragged and dropped "Film" onto Shape.
Next, I followed the steps from earlier to assign my shapes to their corresponding data items.
The following step was to add a filter so only the correct shape was shown - the shape shown would change depending on the selection. This is again done using dashboard actions, which can be found in the dashboard dropdown. My choices now were slightly different from before as this time I wanted to filter as opposed to highlight. The options are shown below.
The important things to note here are the Sheets selected for source and target, as well as the "Exclude all Values" option, which has been selected. This means that once something has been unselected, nothing will be shown as opposed to all the covers being visible.
Top tips for Custom Shapes
PNG – Use PNG files if possible as that removes the background, making the images more appealing.
Don't overdo it – Too many pictures can make your dashboard look messy and cluttered.
Grouping – Shapes are best used to group data, having a different shape for each data point is pointless.
Legends are history – Although your pictures may be recognisable to you, a legend may be needed to clarify their meaning. This can be solved by using your shapes as a Filter accompanied by names.
Sizing is key – Try to select same size shapes if they are going to be used together. Also, try to get good resolution images (though all shapes are scaled down in Tableau, a higher resolution will stop your shapes becoming pixelated).
Naming – Save custom shapes to "My Tableau Repository" with relevant names, this will help when assigning them to data items. If your shapes are in the same order as your data items, the "Assign Palette" button will take care of the sorting for you.