How to do Sheet Swapping with Tableau Layout Containers Switch between different charts with the click of a button In this new and improved approach to sheet swapping, you’ll learn to toggle layout containers on and off by clicking on custom images. This approach is particularly useful for flipping between a visualization and its underlying data.

How to do Sheet Swapping with Tableau Layout Containers

Switch between different charts with the click of a button

In this new and improved approach to sheet swapping, you’ll learn to toggle layout containers on and off by clicking on custom images. This approach is particularly useful for flipping between a visualization and its underlying data.

Hi, this is Ryan with Playfair Data TV. And in this video, I’m going to show you an easier way to do sheet swapping in Tableau compared to the traditional technique of using a parameter control combined with layout containers. This easier approach was made possible with a new feature that’s available as of Tableau 2019.2, which allows you to turn layout containers on and off.

This is one of my favorite techniques. Sheet swapping, in general, is one of my favorite techniques because it allows the end user to choose how they want to visualize a chart. To be honest, one of the most common ways I will use this is when I have an end user that is really comfortable seeing the raw data. So I will provide a sheet swapping method for them to look at a visualization that I’ve designed, but then they can toggle it and then see the raw data below if that’s more comfortable for them.

By the way, if you aren’t upgraded yet to 2019.2, I do share the traditional method for sheet swapping on another video called 3 More Ways to Smooth the Excel Transition. But the approach I’m about to show you is my new favorite approach. It works particularly well if you’re only flipping between two charts. So it could be used for the use case that I just shared, flipping between a visualization and a text table.

To illustrate, though, we will switch between these two charts. We’ll have a scatter plot that looks at Sales and Profit Ratio and bar chart. So little bit better than just the raw text table, but this bar chart represents the raw data for each dimension member in this scatter plot. We’re just visualizing it in a different way.

So to start with, so I’ve built those two sheets in advance. To use this method, those sheets both have to be added to a dashboard. So I’m going to start by dragging my primary view onto the canvas here. So Scatter Plot onto the blank white space. By the way, this also works best if you’re using floating objects because you can control the exact location and you can lay the layout container on top of the primary chart. So note that this is floating.

I’m going to drag Scatter Plot onto the view. And I’ll make this a little bit larger, maybe a 600 by 600 square. And we’re getting a little bit uncentered here. So let me do 200 in and 100 down. So primary chart’s on the view.

The next step for this new and improved way to do sheet swapping is to add a layout container on top of the primary chart with the exact same dimensions. You can use either a horizontal layout container or a vertical layout container. It does not matter. I’ll just throw a vertical container onto the view.

That blue border is telling me where the layout container is. This container needs to be the exact same dimensions as the underlying chart. So that was 600 by 600. And it was 200 pixels in on the x-axis and 100 pixels down on the y-axis. For best results, I recommend making the background of the layout container the same color as the rest of the dashboard. So in this case, I’m just using the default white.

So with this layout container selected, which I know because it has a blue border around it, from the Layout pane, I’m going to click on this background dropdown. And instead of the default none, I’m going to change that to white. Of course, the scatter plot has disappeared. We now have an opaque layout container on top of that scatter plot, but we will correct that in a minute.

The next thing we need to do is add the bar chart, so the secondary chart that I want to toggle on and off, inside of this layout container. So Bar Chart, I’m just going to drag it onto the view. Hold the Shift key. The gray shading has now changed to show me that it’s going to fill that vertical layout container that I added in the last step. If I let go, the bar chart is now inside of that layout container. I will make this fit the entire view to get rid of my scroll bars. And we now have a secondary or detailed chart inside of a layout container with an opaque background laying on top of my primary view.

To bring this to life and make it work, we’re going to use a new feature available as of 2019.2, which allows you to toggle a layout container on and off. To do so, you first need to make sure you have the layout container selected. Right now, I have a gray border around a single chart telling me that that one sheet is selected. The easiest way to select the layout container is to double-click on this gray rectangle.

Notice the gray changed to blue. The blue is now telling me that I have selected the entire container and not just that one individual sheet. Now if I click this down arrow, there’s a new option. It says Add a Show or Hide Button. I’m going to click on that. By default, we see an X.

And by the way, this is already working. It doesn’t work unless you go to a Presentation mode. But just to show you that it is already working, I’ll go to Presentation mode. And by default, you will see an X when the container is being shown. If I click on that X, it will hide the container, and the button will change to a menu looking icon. That means that the container is closed.

So right now, container is closed. The bar chart on top is hidden. If I click this button, it will toggle that container back on, bring my bar chart back into the view. So that’s already nice. It’s already working. You could stop there if you want to.

But I also wanted to show you that you can customize these images. For me, this is an awesome improvement within Tableau. This is allowing us to integrate other products, particularly to help with the design and user experience of the dashboards. But you can now essentially design a button that looks how ever you want. And then you can edit this button and map different images for when that container is being shown or hidden.

So right now, when it’s being shown, I might want to choose a different image. I mean, this isn’t bad. It’s a very nice default. You saw how quickly we were able to make that. But to improve the user experience, maybe when this container is being shown, I’d like to show a little icon of a scatter plot that implies to my end user that if you click on that button, it will turn into a scatter plot.

Well, now if I click this Choose button, I can select or map any image that I want to this button for when that container is being shown. So if I click Choose, go find the file that I want to show, I’ll choose a scatter plot icon when the container is on. And I can also map an image to the button for when the container is hidden. So just to point this out, we’ve got scatter plot icon for when the item is shown. If I click item hidden, notice it went away, and it’s telling me to choose an image for when it is hidden.

Well, when that container is turned off, I want to show a bar chart icon implying that if you click on that button, the bar chart will reappear. So I click Choose, click the bar chart icon. And now when the item is hidden, we’ll see the bar chart picture. When the item is shown, we will see the scatter plot picture. I’ll go ahead and click OK.

And I guess, let me stop there and point out a couple more things. You could also add a tooltip. This is handy to provide a call to action. So I could say, “Do Sheet Swapping!” or whatever you want to do, and these instructions will appear when the user hovers over that button. There’s obviously a couple of other options, but we’ll call this good for now. I’ll click OK.

That’s pretty small. So another thing I’ll point out is these buttons are their own objects now. So just like any other floating object, if I go to the Layout pane, I can change both the dimensions of that floating object as well as its exact location on the x and y-axis. So I just made that icon a little bit bigger. Maybe I’ll drag it so that it’s kind of in line with the right side of my chart.

I’ll go to Presentation mode to test this out one more time. As you can see, we have the layout container open showing us the detailed information of that scatter plot. If you click on the scatter plot button, the container will close. There is my call to action when I hover over the button to tell the end user what’s going to happen. When I click on it, the chart got swapped out, quote, unquote, “swapped out.” This is the new and improved way to do this.

But really what happened is we just turned off the container that had our bar chart inside of it. Now it revealed the underlying scatter plot. This was our primary chart. So here’s where the end user would land. If they’re not comfortable seeing it in this way and they want to get back to that raw data, the icon for the scatter plot has also been swapped out for a bar chart. And if I click on that, the container will reappear. They get their detailed information.

This has been Ryan with Playfair Data TV – thanks for watching!

Tableau Tips & Tricks Videos

Join Playfair+ Today

Members receive exclusive access to hundreds of visual analytics tutorials – plus much more.