The (High)lights Are On, But Nobody’s Home

Today, I’ll be talking about how to highlight all your marks in a visualization (also known as removing unwanted highlighting or disabling Tableau’s default highlighting). Before I describe the process, let me explain what I mean by Tableau’s default highlighting.

Whenever you click on a mark in a visualization, only that mark is highlighted, and everything is grayed out, like with the very last section of my original Into the HIPAA Breaches viz:

The unselected bars were originally gray, but when you click on a bar, they get really grayed out. Not only that, notice how at the end of the GIF, I had to click out of the visualization in order to “un-highlight” the selected bar? I was able to remove the default highlighting that way, but it took an extra click. It’s not the worst thing, but it does interrupt the user experience. 

Now, compare that experience with clicking a bar on my Look-NG Up VNGLOOKUP blog dashboard (also check out the new category Words per Visual to filter blog posts by!):

When you click on a bar, see how the colors on the visualization remain ungrayed out? Visually, it looks more appealing, but also, this is the only change that’s happening to the visualization, allowing the user to track it more easily. While Tableau’s default highlighting feature spotlights the selected mark, the visual change is too drastic (and not needed in this case, as the visual indicator for what was selected has been built into the visualization).

The Process

#1: Set Up Static Example (with Superstore)

  1. Bring SUM(Sales) to Columns and Sub-Category to Rows.
  2. Sort by descending.
  3. Set to Entire View.
  4. You can also add a few additional touches to reduce chartjunk, like adding labels for the SUM(Sales) and hiding the axis, but that’s not necessary. (Don’t change the color of the bars yet; we’ll address this in the next section). You should now have something that looks like this:

#2: Set Up Example Interactivity

Now that we’ve set up the simplest version of the visualization, let’s add in an element of interactivity, so that the color of the bar changes when a user picks a different sub-category.

  1. Create a Sub-Category Parameter. The data type will be String, the allowable values will be from a List, and we’ll be adding the values from the Sub-Category field (a. to avoid manually typing them all in and b. to update the list of values automatically, in the case of a regularly updating data source).
  1. Right-click on the Sub-Category Parameter to Show Parameter on the right side of the canvas.
  1. Remember, we’ve only just created the parameter, so selecting different sub-categories won’t affect the visualization presently.

We need to create a calculated field COLOR: Selected Sub-Category that uses the parameter in it first.

💡
[Sub-Category Parameter] = [Sub-Category]

This calculated field will return two values, True and False.

  1. Drag COLOR: Selected Sub-Category to Color on the Marks Card. You’ll now see that the bar pertaining to the Sub-Category you selected from the parameter drop-down is now a different color from the rest.

(You can now also change the colors of the legend if you wish.)Now, the sub-category you choose will turn orange:

  1. If the color legend didn’t automatically appear on the right side of the canvas, you can show it by going to Analysis at the top > Legends > (legend you’re looking for).
  1. We can control the visualization with the Sub-Category Parameter dropdown now, but let’s make the interactivity more intuitive by adding a worksheet action. Go to Worksheet > Actions > This sheet > Change Parameter…
  1. Configure the parameter action: name it something useful/descriptive, set the action to run on Select, with the Sub-Category Parameter as the target parameter, and Sub-Category as the Source Field.
  1. Hit OK. Time to test!

See how the Sub-Category Parameter updates to whichever sub-category you click on? Perfect, now we’re done setting up the example!

#3: Highlight All / Remove Unwanted Highlighting / Disable Tableau’s Default Highlighting

To recap the first two sections, what we’ve done now is create a simple bar chart that changes one of the bars’ color when the user clicks on it. Note that when you click on a bar, you get the default highlighting Tableau does, with the spotlight of the selected/purple bar, as well as the drastic graying out of all the other bars (which, in this case, are already gray). 

  1. Create a dummy field, i.e. a “fake” field that doesn’t have any real data. It’s going to be a string that you can input whatever you want, wrapped in quotation marks, though if someone else will be viewing your workbook (especially in a professional context), make sure the string isn’t anything inappropriate. I like to either put in an empty string ‘’ or the purpose of the dummy field ‘Highlight All’.
  1. Drag DUMMY FIELD: Highlight All to Detail on the Marks Card. This gives each of the marks in the visualization the value ‘Highlight All’.
  2. Add a second worksheet action, by going to Worksheet > Actions > This sheet > Highlight…
  3. Configure your highlight action by giving it a Name, making the action run on Select, and target the highlighting only for the Selected Field of DUMMY FIELD: Highlight All.
  1. Finally, hit OK. Time to test again!

Now, we can see that the gray bars don’t get additionally grayed out like before, making for a smoother user experience :) 

Final Note

When I first learned how to do this during training, I learned the term as “remove unwanted highlighting,” which was a bit confusing to me, because the term doesn’t quite match up with what we actually did (“remove unwanted highlighting” vs. adding a highlight action).

I didn’t understand it until I realized that what we were actually doing was highlighting every mark that contained a particular value from the selected field (i.e., the ‘Highlight All’ on Detail), so by highlighting everything, you’re technically also highlighting nothing at the same time. Once I reframed it that way, I understood the process a whole lot better. Hope this helps! :)

Author:
Vivian Ng
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2024 The Information Lab