Turn Labels On and Off

Overview

You can give the user the power to turn labels on and off by making use of a sheet-swapping parameter.

The sheet-swapping parameter technique has been around since at least 2015 and has since been improved upon with the show/hide icon functionality (Ryan Sleeper) and parameter actions (Keith Dykstra).

The following simply uses the sheet swapping parameter to display/hide labels in a view. (Edit: After “discovering” and implementing this idea, I found that Paul T McHale already beat me to the punch over a year ago. Check out his blog for another take.)

When to implement

Since this is so well documented already, I’ll only add that before tossing this ability into a viz, weigh the pros and cons to the end user. Is it necessary? Does it add value? Does it increase readability?

How to implement

In my Small-Multiples/Callout viz, I initially created it without labels since it was made up of highlight tables and I felt labels cluttered up the view. However, the downside was that it made it more difficult to identify the small multiples quickly, since the country name doesn’t show up until the user hovers over the mark. (And, there is a slightly delayed response in Tableau Public, so it’s potentially a barrier to the user.) Not only that, but the order of the small-multiples changes depending on the years selected by the user. Sheet-swapping for labels was in order.

So, I duplicated my sheet, turned labels on for the duplicate, then followed the sheet-swapping parameter steps by creating the parameter, adding both of these sheets to a vertical container, and hiding the titles. I displayed the parameter and put it inside my controls container.

At first I arranged the parameter as a compact list, but this seemed counter-intuitive:

“Show Country Labels” displayed while the labels were showing, and “Hide Country Labels” while they were hidden. Changing this to a Single Value List in this case is much clearer:

Lastly, if you have added any dashboard actions to your viz, make sure that you duplicate the actions for the new sheet with the labels displayed:

Then click around to verify that switching sheets doesn’t break the UI or confuse the UX as intended.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: