Hi all, in this blog I’m going to go through the basics of Tableau padding and container tips that I’ve learnt from using Tableau for a bit.
To begin with, I want to talk about tableaus automatic padding when you drag a sheet onto the dashboard. Tableau automatically puts 4 padding around the sheet. For the tiled dashboard that is automatically created in tableau when you drag on a sheet, the padding is 8. To me it’s quite noticeable on any dashboard where the user has forgotten or does not know about padding. All the +4 padding eventually adds up. Even when the sheet is collapsed there might still be the padding on there making it 8 pixels larger than it should be
Padding is incredibly useful if you want to save time later on and also helps out with future maintenance. If you have to create boxes to “make space” or to give a little colour to one side of the sheet, this will slow down tableau as there are now more objects on the dashboard for it to deal with. But be careful when creating a mobile dashboard, as all the formatting, like background colouring, containers and padding will all disappear. This is handy if you want the mobile layout to be a little bit different to what the desktop user sees, but is ultimately a time vacuum.
In Tableau, a sheet will only collapse if there is a discrete pill (blue field) in the rows or columns. Now that it is collapsible, it’s important to note a container will not go less than 30 pixels in height or width unless in another container of a similar type – vertical or horizontal. So that means you can have many vertical containers but if you add a horizontal one in the mix, then you will be left with 30 pixels of blank space once collapsed. This happens because the horizontal container has gone to 0 width to the left but it cannot collapse less than 30 in length.
From experience, I would want to get rid of the tiled container and go with the horizontal or vertical as it is more predictable in what it will do if something needs to collapse or the how the layout of a dashboard should be.
How to select the container a sheet is located in.
There are a few ways to do this
- Double click the black shutter on the sheet if you have clicked it
- Go into the item hierarchy (where layout is) and click 1 level above the sheet
- Click the dropdown arrow on the sheet and select the container it is in
Buttons and collapsing containers
In Tableau you can make a container collapse using a clickable button in two ways.
- The first is by making the container floating and using tableaus default button mechanics (see picture below)
- Make your own button and using it with a parameter action to change the status of the sheet within the container
As the first option is quite easy to do and there are plenty of resources to find how to do this, I’ll focus on the 2nd way as that is in my mind more impressive and better if you don’t want to have floating containers everywhere
Step 1. Create a parameter called “TrueFalse” or any other name of your choice. Make this parameter a Boolean, so TRUE or FALSE
Step 2. Create a calculated field called “switch” with the calculation
When TRUE then FALSE
when FALSE then TRUE
Step 3. Drag the “Switch” field onto the sheet you want to disappear and click to keep true, or to exclude False.
Step 4 . on another sheet create the button you wish to make. Drag the “switch” calc onto the shapes mark. Turn the “TRUE” shape into an up arrow, and the “FALSE” into a down arrow
Step 5. Create 2 calculated fields, “TRUE” with the text TRUE inside and “FALSE” with FALSE inside.
Step 6. Drag these fields onto the button sheet on the details. And make a worksheet filter action to affect the button sheet, and for the source field to be TRUE and the target field FALSE. Show all values if the selection is cleared and run on single select only.
Step 7. On the dashboard run a parameter action on the button to target “TrueFalse”, on the field “Switch”
The button on click should now filter the sheet it’s targeting and will unselect itself on clicking it.
(I’ve included a GIF below if any are still confused)
I hope this blog was useful, any questions, feel free to try to contact me.