top of page
Writer's pictureBernard Kilonzo

Dynamic Charts in Tableau – (Using show/hide button)

image and text

In one of the previous posts, I shared how to create dynamic charts (better known as sheet swapping) using a parameter and a layout container to allow your dashboard consumers decide which chart is shown. Read the post here.

In today’s post, I would like to take a different approach to show you another technique of choosing which chart is shown using show/hide button introduced in Tableau 2019.2.

In this case, I would like to create a dashboard where user can swap between a bar chart and a line chart.

Creating a bar chart

In this case I have created a bar chart showing order year and Profit.

column chart

Creating a line chart

Recreating the same analysis but now using a line chart

line chart

Building the view

While on the floating mode – drag one of the above charts to the dashboard area.

line chart

Drag a vertical or horizontal layout container to the view – ensure it matches the chart in the view by resizing it to fit.

line chart

(Optional: For better results you can format the layout container background color to match that of the charts' background)

tableau layout pane

Drag now the chart to be hidden inside the layout container.

column chart

Select the layout container and add a show/hide button

column chart

Executing this Tableau adds a button on the view

column chart

We can edit this button to replace it with our own image.

To do so, select the button and on the drop down menu choose ‘Edit Button…

column chart

On the pop up menu,

Select button style as ‘Image Button’

Button appearance as ‘Item Shown’

Choose the type of image you would like to show;

In this case I have chosen an image of line chart to be shown when my view is a bar chart.

tableau buttons

Toggle your button to choose what will be shown when the item is hidden.

In this case I have chosen an image of a bar chart when my current view is showing a line chart (when the item (container holding the bar chart) is hidden)

tableau buttons

Executing the above and changing the view to presentation mode, gives us the view below which changes anytime you click on the icon.

dynamic charts in tableau

I hope this was helpful to you. To receive more of the Tableau tips and tricks, kindly subscribe to our mailing list below.

If you like the work we do and would like to work with us, drop us an email on our Contacts page and we’ll reach out!

Thank you for reading!

bottom of page