7/7/2017
Tableau Tips - Volume 11 "Shape Shifters: 10 Tips for Using Shapes in Tableau"


Shapes can be useful in Tableau and they also allow us to be creative with our visualizations. Here are 10 tips for using Shapes in Tableau.

#10 - Use the Tableau built-in shapes


Seems simple enough. Tableau has 97 shapes organized in 9 folders of Shapes built right in for you to use. This includes Filled shapes, Arrows, Bug Tracking, Currency, Gender, KPI, Weather, Proportions and Ratings.



#9 - Add your own custom shapes


In your documents folder, there is a My Tableau Repository folder and inside that folder is a Shapes folder. Simply add directories inside that folder for new icons. Name your directories to organize them.

Navigate to \Documents\My Tableau Repository\Shapes. You will see the default folders that are created when you install Tableau.



Create folders and load icons. You can purchase sets of icons from websites like iStock.com, but there are tons of free icons available as well. Simply Google "free icons" and you'll find lots of them. Just be sure they are "royalty free" icons.

Here is one of my favorite free icon sets to get you started:
@HighVizAbility
Simply copy the folder of icons into your Shapes folder.



#8 - Reload new shapes without restarting Tableau


Unlike custom color palettes, you do not need to close Tableau and restart it for the new custom shapes to show up. Select Shapes from the Marks card, then More Shapes. Then simply click the Reload Shapes button. Your new shapes will automatically appear in the dropdown list, alphabetically after the "Default" and "Filled" shapes.




Select the new folder that you added and your new icons are now ready to use in Tableau.




#7 - Use transparent PNG files when possible


It's best to use transparent PNG files when possible. This will give you the most flexibility in Tableau. Non-transparent graphics will have a background color. This may be ok, assuming it matches the background color of you worksheet. However, a transparent PNG file will allow you to color the icon and place it on whatever background you like.



Tableau allows data to be encoded to Shape and Color. Using transparent PNG images will allow different colors, for example on Category or Segment.



#6 - Adjusting color of shapes without encoding data


If you don't have any pills on Color then you can't change the color of your shapes. This can be easily resolved using a dummy field. Just create a calculated field with a dummy string. Then place it on Color on the Marks card.




#5 - Use Shapes to add a help icon


Shapes are a great way to priovide the user with a custom icon for help or information. Examples might be, how to use the viz, what to click or hover or how to filter. You could also provide details on the author and the data source. Find the icon and load it (Tip #9 and #8). Then create a dummy calculated field. Select Shapes from the dropdown menu on the Marks card and then move the new field to Shapes. Click Shapes and select your new Shape. The rest is formatting.

Format the tooltip with the desired information and remove the Row and Column dividers under Border formatting. Place this worksheet on your dashboard and you now have a help button.



Ryan Sleeper also has a great post on how to do this here.

#4 - Use custom shapes to create custom legends


There are a number of different ways to do this, but one of the easiest ways is to create a new worksheet with a single field on Rows for the category in your legend. Make sure it's colored on the same field as your legend and using the shape that you want in your legend. Also, remove all borders and headers so that nothing is showing but the shapes.



Then add your new worksheet to your dashboard as a floating tile. Set the tile to fit entire view and right-click and hide the title. Place the legend over the current legend on your dashboard. I find it easiest to float the default color legend as well as your new custom legend. Then you can line them up and control the order. The defualt color legend should be set to the back and the custom legend on top of it. You will now have a custom color legend that filters/highlights the viz, but with a custom shape.




#3 - Shape Shifter: using a parameter to control shapes


In addition to dimensions and measures on Shapes, you can also put a Parameter on Shapes. Simply create a new parameter with whatever values you want to assign to shapes. Then add the new parameter to Shapes on the Marks card. You will need to assign each one to the desired shape, but once you do this, Tableau will remember the assigned Shapes.



Showing the parameter (and using a calculated field for the filtering) we are now Shape Shifters.



#2 - Reduce file size by organizing your shapes


When Tableau saves a workbook, the shapes are converted to 16 bit images and stored in the TWB file. This is great, but it's important to know that it doesn't simply save the icons you are using in the viz. It saves ALL of the icons in that particular folder. In other words, if you use 1 single icon from the 1,000 Free Icon set then it will store 1,000 icons in the TWB file. Thankfully these are typically very small files and it's stored as text, but they can certainly add up.

Here is a comparison of file sizes using one worksheet with 3 marks with the Superstore data:

Circle (not using a Shape): 1,201kb file size
Single Shape from 1,000 free icons folder: 3,098kb file size
Single Shape in its own folder: 1,206kb file size

As you can see, the file size is dramatically affected by the number of icons in the folders that you are using. To keep the file size as small as possible, put all of the icons that you are using in one single folder without any additional icons.


#1 - Download a zip file of all of the shapes in a Tableau Public Workbook


All of the custom shapes are stored in the Tableau TWB file encoded in Base64. Matt York created a web tool back in 2014, but just updated it today so that it would work with the new Tableau URLs (and http and https). The tool will automatically extract the base64 encoding from the TWB file and convert it back to an image. Visit Matt's website and add the bookmark to your browser. Then on any Tableau Public Visualization, you can simply click the bookmarked button and it will download a zip file of every shape in that Public workbook. Super simple!

Matt's Webpage is:
https://shapeextractor.herokuapp.com/





You can also enter the viz manually into the URL.
http://shapeextractor.herokuapp.com/shapes?viz=

The Viz URL needs to be in this format:
http://public.tableau.com/views/[Workbook Name]/[Worksheet Name]

Putting it all together:
http://shapeextractor.herokuapp.com/shapes?viz=http://public.tableau.com/views/pokemon/overallmetricsbytype

Entering this string in your browser will download a ZIP file of all of the shapes used in that viz. (lick here to give it a test run). Since you can run this from a URL, you could also provide a button on your viz to allow users to download all of the shapes in the viz. Lots of possibilities with this one!


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