When I first started out using Tableau I was happy to see how easy it was to place my visuals onto the dashboard by using the floating option. It allowed me to drag my items across the dashboard almost in no time. As I became more experienced with Tableau I realized that floating objects are not always easy to handle.
In this blog post we are going to ‘discover’ the alternative in Tableau for the floating option/objects.
Challenges with floating objects started for me when I needed to relocate a group of items – this process became tedious as I had to drag each item one by one and position them back in the same order as before. In addition to this, I also experienced the following problem: when adjusting the dashboard’s overall size, all my floating items would decide to shrink or grow respectively to the dashboard’s size I have set. As a result I had to adjust the size of each object separately. After a while of struggling it was time to explore Tableau’s functionality further. This is when I took a look into the arsenal where I found an object which I have considered to be obsolete to me: containers.
- Difference in containers: Vertical & Horizontal
When we open Tableau and create a dashboard, in the objects pane we can find two types of containers:
- Horizontal container,
- Vertical container.
Horizontal containers allow you to put your items next to each other grouped in one place (figure 1).
Whereas vertical containers give you the option to stack your items in vertical position (figure 2).
2. Tiled or floating containers
In addition to stacking within a container, you can use these containers as floating objects. This means you can drag them freely across the dashboard (the same way as we did with our items before) or you can give them a fixed position on the dashboard with the option ‘Tiled’.
The ‘Tiled’ option allows you to place your items directly into a container. Note that if your dashboard is empty, Tableau will automatically create a tiled container when you drop the first sheet or object.
3. Container overview on dashboards
In the section ‘Item hierarchy’ you have an overview on the items placed in a container. Here, you can change the name of the containers you are using – this is quite helpful when you need to find a certain container or object later on.
In the screenshot below you can see how I used containers to stack a few text objects.
Most of the times (depending on the layout requirements), we will end up mixing these two options: floating and tiled containers. A good tip: if you have objects which are already floating, but need to be stacked in a container -> hold the shift-key and drag the items on top of the container.
4. Organizing sheets in containers
Now that we know what is possible with a container, what happens to the items placed in them? Will they also resize when adjusting dashboards size given that the container is set to be floating?
That really depends: if the container is just floating and the option ‘Distribute Contents Evenly’ is not selected then the container-children (container-children: items that are placed in a general container) will stick to their original size. If the option is selected, then items will adjust respectively to the size of the container.
We can always fix the size of the children items:
In horizontal containers the items option to fix size will be ‘Fix Width’.
5. Custom blocks
Containers – fun right? Knowing their benefits and use, lets now take a step further and build a custom block with rounded edges. Since Tableau does not support CSS for styling, we need to be somewhat creative and use images as an alternative.
The tools you can use for designing the block corners, really depends on your personal preference.Personally, I find Photoshop to be ideal for the job.
In total we will need 4 PNGs which will represent the block corners:
- Top left corner,
- Top right corner,
- Bottom left corner,
- Bottom right corner.
We will start off with the top of the custom block:
- Select the option ‘floating’ and drag horizontal container onto the dashboard:
2. We go back to the objects pane and select the ‘Tiled’ option and afterwards, we drag the image object into the container. Select ‘Left-corner’ slice which you have created.
3. Add next to the image object, a blank object (still using Tiled option):
4. Add an image object (with the top-right corner of the block) to the right of the blank object. Remove the outer padding (set to 0) for each object. You can do this in the layout section on the left pane.
5. Below is the result we get after our manipulations (For now hold off with resizing the container)
6. Repeat these steps for the bottom part of the block.
7. Now that we have our top and bottom of the block, it is time to create the body for it. For this, we will need a vertical container. This container will contain our top and bottom parts, which will be stacked on top of each other.
Select the floating option and drag a vertical container onto the dashboard. Then either change the option to ‘Tiled’ or hold the shift key and drag a ‘blank’ object into the container.
8. Now we need to place our top and bottom in the vertical container. Try to place ‘Top’ above the ‘blank’ object and ‘bottom’ under it. To do so, select your previously filled container and while holding the shift key drag them into the vertical container. You should end up with something like this:
9. Now it’s time to change top and bottom’s size. Select the ‘Blank’ object in the container and double click on the selector shown on the image below:
Double clicking will select the parent container of that ‘Blank’ object. If everything is done correctly, the parent container should light up in blue:
10. Set the size of the container to the size of the images you have placed in the container (But before doing that, you need also to set outer padding to 0).
Repeat the steps for the bottom part.
After all the manipulations you will end up with the following:
We need to replace the blank object with a vertical or horizontal container to place our visualizations and stack them in the order we want.
How do we do that? First, place the container above or under the ‘blank’ object. Adjust the background to the color of your preference (for example: white). After that, remove the ‘blank’ object. You can do this by click on the object and pressing the X at the top right corner of the selected item.
Final result: Custom block with rounded edges.
6. Conclusion
At first, floating objects seem to be a very good tool to use when making the dashboards in Tableau. After a while, once you gain more experience in Tableau dashboard development, the benefits of the containers will open your eyes. Especially if you need to create custom layout and introduce changes to them afterwards.