Chapter 63. How to Highlight a Dimension

In my US Income by Age and Marital Status viz (which we’ll look at momentarily), I wanted my end users to be able to choose their personal combination of age, marital status, and income—then have the chart not only filter down to their demographic information, but highlight their income in context of their other selections. This is another example of driving engagement by making the end user part of the story.

I thought this would be as easy as right-clicking the axis for income, a field that is a bin dimension in my viz (i.e., used to make a histogram), and choosing “add reference line.” I would then make a reference band to get the nice yellow highlight effect you see pictured.

This is when I found out you can only add reference lines to measures or date dimensions.

This chapter shares a workaround for adding a “reference line” to a dimension.

How to Add a Reference Line to a Dimension

Let’s start by taking a look at the visualization. In the interactive version, plugging in your own combination of age, marital status, and income filters and highlights the viz:

prta 6301

The first two filters, filing status and age, are simply filters that filter the entire viz to the end user’s selection. The viz also works when the end user does not change these filters, in the case that he wants to see how his income compares across the entire population ...

Get Practical Tableau now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.