ToolTIPS – Advanced Edition

ToolTIPS – Advanced Edition

Welcome to part two of my toolTIP series, the Advanced Edition.  If you missed part 1, the Basic Edition, check it out here and then come back. Otherwise…you take the red pill—you stay in Wonderland, and I show you how deep the rabbit hole goes.


pill


Calcs

Let’s start off slow… with some conditionally colored text

You can color text based on a value by creating two conditional calcs and not specifying an ELSE which will return a null value.  Then, put the two calcs next two each other in the tooltip and color the calcs appropriately.

IF [Candidate] = 'Clinton' THEN [Candidate] END
IF [Candidate] = 'Trump' THEN [Candidate] END

Here is the tooltip setup and GIF.

2016-10-29_23-59-11-copy

conditional

Click here to interact with this dashboard


Let’s take it up notch…with dynamic lines

I mentioned in the last post that lines make a big difference.  However, sometimes your dimensions are of varying text lengths.  In this case, hardcoding a line with an underscore doesn’t work very well. Here is an example showing the hardcoded line looking great with Laredo, Texas and just so-so with North Charleston, South Carolina.

We can a create a calc so the line will dynamically  change to the length of your dimension.  In this case, I want the line to be about 95% of the length of the city, state.

REPLACE(SPACE((LEN([City] + ', ' + [State])*1.5)*.95),' ','_')
  • The LEN calc determines the length of the ‘city, state’ string as a numerical value.
  • The SPACE calc creates a string of spaces equal to the number passed.
  • I am using font size 10 Tableau Book for my city, state.  I want to use font size 5 for this dynamic line to reduce the vertical space on either side of the line.
  • Since I am using a smaller font size, I am multiplying by 1.5 to account for the font size reduction – this was trial and error and would vary by font.
  • I also want the line to be slightly shorter than the ‘city, state’ so I multiplied by .95.
  • The REPLACE calc will replace each space in the SPACE string with an underscore.

I used to do this dynamic calc slightly differently, so hat tip to Rody Zakovich for improving it.  I added a space of font size 4 below the line because the underscore is vertically aligned at the bottom of the row.  Here is the tooltip setup and GIF.

2016-10-29_23-37-30

dynamic-line


You’re still here?  Let’s get crazy…multiple tooltips with a different number of lines and different dimensions in a single sheet

I ran across a situation at work where I had to create a single map of oil platforms in the ocean with production statistics and regional inspection offices on land with addresses and description of activities.  I was up to the challenge, strap in, here we go.

The data below is fake and to ensure you know it is fake, I have placed my oil platform in Lake Ontario near my house and I will be inspecting from the Dinosaur BBQ restaurant in Rochester, NY.

oilrig

Here is the tooltip setup.

2016-10-30_01-09-30

As you can see above, the tooltip setup is pretty simple looking, but pretty much everything is a calc. The real trick is here is that each calc is a string and within the string I used ‘+ char(10) +’, which is essentially a line break. So anywhere you see char(10) below, I am telling the calc to start the next part on a new row. This is how I can get the different number of rows in a single calc. Also, locations on land had nulls for the oil/gas production so they null out in the tooltip.

Here are the calcs.

TT Structure RB

CASE [Type]
WHEN 'Building' THEN [Structure Name]
WHEN 'Platform' THEN IF ISNULL(str([Complex ID])) THEN 'Structure: ' + [Structure Name] ELSE 'Complex: ' + str([Complex ID]) + char(10) + 'Structure: ' + [Structure Name] END
END

TT Location RB

CASE [Type]
WHEN 'Building' THEN [Location] + char(10) + [Location 2]
WHEN 'Platform' THEN [Company/Owner] +char(10) + 'Water Depth ' + str([Water Depth (ft)]) +'ft'
END

TT Details RB1

CASE [Type]
WHEN 'Building' THEN [Func1] + char(10) + [Func2] + char(10) + [Func3] + char(10) + IFNULL([Func4],'')
WHEN 'Platform' 
    THEN 'Fake Oil Production: '
END

TT Details Copy

CASE ATTR([Type])
WHEN 'Platform' 
    THEN 'Fake Gas Production: '
END

Let’s bring it down a little…ASCII characters

The main idea is that you can treat ASCII characters like text in a calc.  Therefore, you can do stuff like return a ‘▲’ for an increase and a ‘▼’ for a decrease.  You can color these symbols too.

This has been around for awhile so I am just going to link to some resources.

Andy Cotgreave has a whole series of bar in tooltips, spark bars, etc, here.

Jeffrey Shaffer has a blog for uses of symbols including tooltips here.

Rody Zakovich created a 100 mark unit chart in a tooltip here.

Great resource for symbols:

Wikipedia Miscellaneous Symbols

Wikipedia Geometric Shapes


Responsive vs. On Hover Tooltips

What is the difference?  Responsive tooltips never disappear while you are hovering over a mark, while On Hover does not appear until you stop and hover over a mark.  Look at the GIFs below to see the different behavior.

Responsive
Responsive
On Hover
On Hover

How do you control the tooltip behavior? There is a dropdown on the tooltip window.

2016-10-30_02-36-32


Menu Actions

URL doesn’t appear

The reason it is important to understand responsive vs. on hover tooltips is because it impacts menu actions.  If you have the tooltip set to responsive (default), a menu action will not appear until a user clicks on a mark.  This means they might never find it.  If you have it set to On Hover, the menu action will always appear when the tooltip comes up.

Responsive
Responsive
On Hover
On Hover

My recommendation is to use On Hover if you have a menu action.  Most people might not even see your tooltip and the odds are pretty low they would know to click for further interaction options.  Using On Hover ensures it will be seen at all times.  Also, at some point responsive tooltips become more like on hover on Tableau Public/Server.  I have not figured out the magic formula of when that happens (I suspect it is a mark/file size combo), but if that happens, there is no advantage to responsive anyway.


Menu action text

Whatever you name the menu action is what will appear in your tooltip.  I discovered you can also use ASCII characters in the menu action text (link icon shown below).

ASCII in Menu Action
ASCII in Menu Action

You can also make this text dynamic by inserting a dimension into the name.

Dynamic Menu Action Text
Dynamic Menu Action Text

menu


Well it looks like this is getting a bit long so I will stop here. Be on the lookout for part three of this series, ToolTIPS – Mobile Edition.

I hope this was helpful. Thanks for reading.

2 thoughts on “ToolTIPS – Advanced Edition

Leave a Reply