Tooltips: going beyond simple information

by Gwilym Lockwood

Tooltips are great. They automatically capture the information that goes into the view (and more that you can drag in besides), and then pop up when you explore the viz.

For example, here’s a tooltip from one of my first vizzes at the Data School. It’s a visualisation of the gender gap in GCSE performance across mixed state schools in England. Each bar represents a school, and if you hover over one of them, that school’s information comes up in the tooltip:


This is informative, but rather dry. With a few calculated fields, tooltips can go a lot further, explaining the viz in full sentences.

For example, take this highly serious quantified self viz of the Data Schoolers. You can tell it’s highly serious because it’s all in Comic Sans, that’s how you know it’s proper professional. We took various measurements, such as height, arm length (fingertip to fingertip), foot length, and head size. I looked at height versus arm length, and categorised people as apes for if their arms are longer than their height or a T-Rex for if their arms are shorter than their height:


(all icons by Freepik on

The tooltips here are full sentences, created with a few extra calculated fields. The basic sentence is the same for each person, but there are several words that need to change;

SOMEBODY is A T-REX/AN APE because HIS/HER arms are SHORTER/LONGER than HIS/HER height.

SOMEBODY is already coded in the Name dimension, which is handy. The ape vs. T-Rex classification is also in as a calculated field (if arms > height then ape, elseif arms < height then T-Rex, else same), but if we just put that in the tooltip, the sentence won’t work well; we also need to change the determiner a/an so that we don’t get “a ape” or “an T-Rex”. So, I duplicated that calculated field and added the determiner in there.

HIS/HER depends on whether the name is male or female. We have a gender dimension in the data, so we now need to create a calculated field saying “if gender = F, then “her”, else “his” “. The same kind of thing goes for shorter or longer; create a calculated field saying “shorter than” if arms < height, “longer than” if arms > height, and “same as” if arms = height.

After creating all these calculated fields, you can drag them onto the tooltip shelf, and insert them in the tooltip:


The downside is that this creates a lot of calculated fields, which clutter up the data pane and can get confusing if you don’t name them well. But it’s definitely worth it for the flexibility and interactivity that well-written tooltips give your viz.