Updated: 5 hours ago
The following blog by Brian Moore was originally published on Do Mo(o)re With Data March2 , 2022 and is cross-posted here with permission. Brian is a Tableau Ambassador and a Senior Data Analytics and Viz Consultant for Cleartelligence.
Installment One of ‘It Depends’ discusses the different methods for avoiding the default highlighting that occurs in Tableau when a mark is selected. Three different techniques are reviewed with recommendations on when to use them and instructions on how to apply them.
The thing that I love most about Tableau is the incredible flexibility. No matter what you are trying to do, there is a way to do it. And more often than not, there are actually several ways to do it. That’s where this series comes in. There are so many incredible hacks and techniques floating out there in the Tableau Universe, it can be difficult to figure out which ones to use and when. In each installment of this series we’ll be focusing on one specific ‘question’ and discuss the pros, cons, and use cases of various techniques. And our first question of the series is… “How do I turn off the default highlighting in Tableau when I click on a mark?”. And the answer is, of course, “It Depends”.
First off, what are we talking about when we say ‘default highlighting’? As I’m sure you have noticed, when you click on a mark in Tableau, something happens to the mark you selected, and to all of the other marks in your view. When you click on a text mark, you get a blue box on the selected mark and all of the other marks fade. When you click on any other type of mark, that mark retains it’s formatting (sometimes with an extra black box around it) and the rest of the marks fade. And then everything in that view goes back to normal when you click on something else.
This behavior makes sense. When a mark is selected, you should know which mark that is. But the result, in my opinion, does not look great. It would be really nice if we could control what the selected and non-selected marks look like.
This post is going to focus on three techniques that will allow you to do just that. We’ll call them the ‘Highlight Technique’, the ‘Filter Technique’, and the ‘Transparent Technique’. First, let’s talk a little bit about each of these techniques, and then we’ll walk through how to apply them. If you’re familiar with the techniques and are just looking for a reminder on how to do one of them, feel free to skip ahead.
The Highlight Technique
This technique leverages a highlight action and essentially highlights every mark when any mark is selected. What I love about this technique is that it’s very simple to set up, and it can be applied to multiple worksheets. With a single action, you can ‘turn off’ highlighting for your entire dashboard…as long as your dashboard doesn’t contain a specific mark type. One of the major drawbacks of this approach is that it does not work with text marks. Instead of getting rid of the blue boxes on your BANs, this technique will turn them yellow. Another drawback of this approach is that it doesn’t actually de-select the mark, it just masks the selection. You can still see a black border around the selected mark, and if you have something that could be clicked on multiple times in a row (like a scroll button), it makes for a clunky user experience. Users would have to click the mark three times to run the action twice (once to run the action, a second time to de-select the mark, and a third time to run the action again). And one last drawback is if you have the opacity turned down on a mark, when you click on it, the mark will show at full opacity.
The Filter Technique
This technique leverages a filter action, and to be completely honest, I’m not entirely sure how it works. But it works great! I was first introduced to this technique by Yuri Fal, during a Twitter discussion on this exact topic, and several others have written about it since. What I love about this technique is that it actually de-selects the mark after you click on it, unlike the Highlight Technique. It also works on any chart type. The only downsides I have found with this approach are that it’s a little tricky to set up, you have to create a separate action for every worksheet on your dashboard, and it does not work well in conjunction with some other actions, mainly other filter actions and set controls. The issue with using this technique with other actions is that you cannot leverage the ‘Clearing the selection will…’ options. So basically there is no option to undo your action. This is a major drawback if you’re trying to use set controls, or another filter action, but not so much with parameter actions since you can replicate that ‘Clearing’ function with a calculated field.
The Transparent Technique
I haven’t used this technique much in the past (mainly because I learned the other techniques first), but it’s definitely something I will use more in the future. I first came across this approach in Kevin Flerlage’s blog post, 14 Use Cases for Transparent Shapes. It leverages a transparent shape that can be built in PowerPoint or other design tools and, unlike the other techniques, it does not rely on dashboard actions. Everything can be done in your worksheet. Because the transparent shape doesn’t have a border, or any fill, there is nothing for Tableau to highlight when it’s selected. Another way that it differs from the other approaches is that the Highlight and Filter techniques can be used almost universally (with the few exceptions we discussed earlier), but this approach has pretty limited applications when it comes to avoiding highlighting (but a wide variety of other awesome applications that you can read more about in Kevin’s post). The two use cases that we’ll focus on are text marks and buttons. Personally, I wouldn’t recommend trying this approach for any chart type where the marks aren’t uniform in size and spacing (but that doesn’t mean you can’t try it). Another downside of this approach is that it does not actually de-select a mark, it just masks it, similar to the Highlight Technique. But on the upside, it’s probably the easiest of the three methods to implement, at least for text marks.
Alright, so let’s bring that all together:
Now it should be clear which technique you should use right? Of course not. It depends. So let’s look at a few specific common use cases.
Which Technique to Use When
As I mentioned earlier, the Highlight Technique does not work with text marks, so that leaves two options. Up until recently I would have said with 100% confidence that you should use the Filter Technique. The main difference here is that if you have more than one mark in your worksheet, the Transparent Technique will fade the other marks, and the Filter Technique will retain all formatting (so you’ll want to use other indicators, like color, to show which mark is selected). With most mark types you’re trying to avoid that fading, but it actually works pretty well with text marks. What we really want to do here is get rid of that blue box, which both options will do. Here are the two methods, the Transparent Technique as is, and the Filter Technique using color to indicate the selected mark
Both look great, but I would give the edge to the Transparent Technique because of how easy it is to set up. But I encourage you to try both methods and see which one you prefer
There aren’t really any limitations on this use case. All three methods will work, but what works best might depend on how your buttons are built and how they will be used. If you built your button in Tableau using the Circle or Square mark type, or if you built them in another tool and brought them in as custom shapes, I wouldn’t recommend using the Transparent Technique. For this technique to work you would have to create two worksheets, one with buttons and one with transparent shapes, and then layer the sheets so that the transparent shapes in your top sheet are aligned perfectly with the buttons on your bottom sheet. Not terribly difficult, but the other methods are easier in this case. The only time I would recommend using the Transparent Technique for buttons over the other techniques, is if your buttons are not actually in Tableau at all, and are instead, part of a background image. You could design and incorporate your buttons directly into your background with other design tools, and then use this technique to make them act and appear as buttons in Tableau.
The next consideration would be whether or not a button might be clicked multiple times in a row, like it would with a scroll button. In that case I would definitely go with the Filter Technique as that’s the only one of these techniques that actually de-selects the mark. As I mentioned earlier, without that de-selection, users will have to click the button three times to run the action twice in a row. If multiple clicks aren’t a concern, you can also use the Highlight Technique, but my vote goes to the Filter Technique. Overall it makes for the best user experience and can make running your dashboard actions smooth and app-like. It’s worth the little bit of extra effort to set it up.
Any Other Chart Type
If you’re running an action from any other type of chart, like a bar chart or a scatterplot, I would not recommend using the Transparent Technique. You may be able to get it to work (on a scatterplot at least), but similar to the Buttons use case, there is an easier way. I will always default to the Filter Technique, because I think it provides the best user experience. Again, it may take longer to set up, but in my experience, it’s usually worth it. However, there are times when that is not an option. As I mentioned before, with that technique, you lose the ability to ‘Clear the Selection’. That means no set controls, no filter actions, and extra work for parameter actions. If I’m running a parameter action, I will usually still put in the effort to use the Filter Technique (and use a calculated field in the action to clear the selection). If I’m running a filter action, or using set controls, I will use the Highlight Technique. So my vote here again goes to the Filter Technique (when possible).
Turn Off All Highlighting
Sometimes, I have a dashboard with no interactivity, but I still don’t want users to click on something and trigger that highlighting. If you aren’t using your tooltips you could just put a floating blank over your whole dashboard and call it a day. But in most cases I still want the users to see the tooltips. In that case, the Highlight Trick is fantastic. It’s quick to set up and it can be applied to every chart in your dashboard with a single action (except for text marks). You could set up the Filter Technique on each of your worksheets individually, or build duplicates of each and try to layer them with the Transparent Technique, but in this case, the Highlight Technique definitely gets the vote.
So to summarize; for text marks, like BANs, I recommend the Transparent Technique, for any other types of charts that are running a parameter action, I recommend the Filter Technique, and for charts running filter actions or using set controls, or for mass highlight removal, I recommend the Highlight Technique.
Perfect, now what exactly are these techniques?
The Three Techniques
Here’s a quick walk-through of each of the three techniques. One thing to keep in mind is that we are only going to cover how to remove the highlighting. In a lot of cases, once you remove the highlighting, it’s still important to indicate which mark is selected. This is especially true if you are using actions to filter your dashboard. I review a few ways to do this in a post I wrote a while back on the Highlight Technique, but this post is already long enough so I’m not going to repeat them here.
The Highlight Technique
Create a calculated field. This field can be called whatever you want and can contain any non-aggregate value. The key is that this field will be the same on every single row in your data (and every mark in your worksheet). I typically name my field ‘HL’ and use a blank value (in calc body, just enter ”). For this example, I’m going to use ‘I<3Tableau’
Drag your ‘HL’ field to Detail on the marks card on ALL worksheets where you want to disable highlighting
Go back to your dashboard and add a Highlight Action by clicking on ‘Dashboard’ in the upper section above the toolbar, and then selecting ‘Actions’. Then click ‘Add Action’ and select ‘Highlight’
Update your Highlight Action. In this example I want to turn off the highlighting on my bar chart and my scatterplot, so I’ve added the ‘HL’ field to detail on both of those worksheets
Give your action a descriptive name so it’s easy to find and edit later on
Under Source Sheets, select ALL of the worksheets where you want to disable highlighting
Under Target Sheets, also select ALL of the worksheets where you want to disable highlighting
Run the Action on Select
Under Target Highlighting choose ‘Selected Fields’
Choose the ‘HL’ field from the list of fields
Your updated action should look like this
Once that’s done, click ‘OK’ and test your action. Usually if the action is not working as expected it’s because the ‘HL’ field is not on detail, or because it’s a mark type that’s not supported by this technique (Text marks).
The Filter Technique
Create a calculated field called 0 and enter the number 0 in the body of the calculation
Repeat the step above but use 1 for the calculation name and the value in the body of the calculation
Right click on both new fields, 0 and 1, and change them to a dimension
Drag both new fields to Detail on the marks card on the worksheet where you want to disable highlighting (this technique can only support one sheet at a time)
Go back to your dashboard and add a Filter Action by clicking on ‘Dashboard’ in the upper section above the toolbar, and then selecting ‘Actions’. Then click ‘Add Action’ and select ‘Filter’
Update your Filter Action. In this example I want to turn off the highlighting on the BANs, so I’ve added the 0 and 1 fields to detail on that worksheet.
Give your action a descriptive name so it’s easy to find and edit later on
Under Source Sheets, keep the active dashboard selected in the drop-down and then select the worksheet where you want to disable highlighting from the options below (the list of sheets in your dashboard)