Allowing Users to Dynamically Swap Visuals on a Dashboard…
By: Aasavari Kaley
Tags: Data Visualization, Tableau, Data Science, Data, Data Analysis

Allowing Users to Dynamically Swap Visuals on a Dashboard…

One of the techniques, perhaps, widely used to create rich, interactive yet clutter-free dashboards is sheet swapping.

Sheet swapping essentially involves, dynamically swapping of one view to display another.

This brief article will walk you through, how to enable your dashboard users to swap visuals in real-time using containers in Tableau.

Step 1: Make your visuals/charts/views

I’ve created a simple scatter plot and a Bar plot as below.

The Scatter plot above indicates the profit made by each of the sub-categories. The red vertical line provides an insight into what the overall average profit looks like.

The bar plot above indicates the total sales for each of the subcategories.

Step 2: Building a Dashboard

Bring in your first visual/sheet onto a dashboard as below and make it floating in nature.

The important step here is to specify the x/y co-ordinates as well as the width and height of the sheet. These functions are present In the Layout tabs (on your extreme left), once you select the sheet in the dashboard.

Step 3: Layering the Dashboard

Add a floating horizontal or vertical container in your dashboard, on top of the previous sheet we added in the previous steps . Be sure to make the container, the exact same size, with respect to the x/y coordinates along with the width and height as the scatter plot.

Your dashboard should like below once all the above steps are done.

Step 4: Filling the container and adding the final layer to the dashboard

Add your other sheet/visual, in my case, the bar plot inside the horizontal container

Hide your titles from both the sheets, so the swapping works seamlessly.

Step 5:Adding the swap button

Click on the container’s drop-down option and select the ‘Add Show/Hide Button’.

This button will allow us to swap between the two views in the dashboard.

After you select the ‘Add Show/Hide Button’, a cross icon would appear at the top right corner of your visual as below

Step 6: Make the Swap icon intuitive and user friendly.

Choose two images of your choice and save it under your ‘Shapes’ folder, residing in your ‘My Tableau Repository’

These images will be displayed and made clickable for the user to swap between the two visuals you created above.

I chose the below two images:

The below bar chart icon would show up, when the scatter plot visual is displayed, to indicate that the user needs to click on this icon to switch to the bar chart view.

The below scatter chart icon would show up when the bar chart visual is displayed, to indicate that the user needs to click on this icon to switch to the scatter chart view.

Step 7: Add the new icons to the dashboard

Click on the dropdown of the Cross icon like below, and select the ‘Edit Button’ option.

Select ‘Item Shown’ option under ‘Button Appearance’ and choose the image, you wish to be reflected in the default view of your dashboard (Bar chart icon, if your default view is scatter plot or vice versa).

Next, select the ‘Item Hidden’ option under ‘Button Appearance’ and select the other icon.

Once you click ‘OK’, below is what your visual would look like.

Note: I had chosen the scatter plot icon under the ‘Item Shown’ option under ‘Button Appearance’.

The swapping technique only works in the presentation mode, so to see if your swapping action works, switch to the presentation mode by clicking the below-highlighted option.

Your dashboard would display as below:

Once you click on the scatter plot, the visual should change to the scatter plot visual like below, with the bar in the top right to switch back to the bar chart visual.

When you click on the bar chart, it will switch to the scatter view again.

You can find and download this dashboard from Tableau Public.