Tuesday, November 14, 2017

Published November 14, 2017 by with 1 comment

How Do You Make Dynamic Tooltips In Tableau Public And Update Them Based On Your Data?

In some of my posts, I have tooltips that adapt to the data you are hovering over and I figured I'd type up a quick tutorial on how I do that.
An example of this is the following visualization from this post:


If you hover over October 7th, 2016 for example, you'll see the following added to the tooptip:

Recording released of Trump explaining that he likes to grab women by the pussy and that he ges away with it

This is really simple to do and there's probably a better way to do it than what I did, but basically:
  • Add a dimension (I called it Tooltip)
  • Put in the logic for the dynamic tooltip text (see mine below)
  • Drag it into the Marks section
  • Right-click on it and make it an attribute
  • Add it to the actual tooltip's display
Tooltip dimension definition:

IF ((Date >= DATE("Jun 15, 2015")) AND (Date <= DATE("Jun 17, 2015"))) THEN "Trump announces he is running for president"
ELSEIF ((Date >= DATE("Jul 19, 2015")) AND (Date <= DATE("Jul 21, 2015"))) THEN "Trump makes headlines for stating that POWs (specifically Mccain) are not war heroes"
ELSEIF ((Date >= DATE("Aug 7, 2015")) AND (Date <= DATE("Aug 9, 2015"))) THEN "Trump booted from conservative forum."
ELSEIF ((Date >= DATE("Oct 12, 2015")) AND (Date <= DATE("Oct 14, 2015"))) THEN "Democratic Debate"
ELSEIF ((Date >= DATE("Nov 15, 2015")) AND (Date <= DATE("Nov 15, 2015"))) THEN "Democratic Debate"
ELSEIF ((Date >= DATE("Dec 18, 2015")) AND (Date <= DATE("Dec 20, 2015"))) THEN "Democratic Debate"
ELSEIF ((Date >= DATE("Nov 5, 2015")) AND (Date <= DATE("Nov 7, 2015"))) THEN "CNN reports that they cannot confirm Carson's childhood stories"
ELSEIF ((Date >= DATE("Dec 5, 2015")) AND (Date <= DATE("Dec 7, 2015"))) THEN "Trump announces planned Muslim ban"
ELSEIF ((Date >= DATE("Feb 8, 2016")) AND (Date <= DATE("Feb 10, 2016"))) THEN "Sanders wins the New Hampshire primary in a landslide"
ELSEIF ((Date >= DATE("Feb 20, 2016")) AND (Date <= DATE("Feb 22, 2016"))) THEN "Bush announces he is ending his campaign"
ELSEIF ((Date >= DATE("May 3, 2016")) AND (Date <= DATE("May 6, 2016"))) THEN "Trump effectively becomes GOP nominee for president"
ELSEIF ((Date >= DATE("Jul 5, 2016")) AND (Date <= DATE("Jul 7, 2016"))) THEN "FBI announces no charges for Clinton's e-mail investigation"
ELSEIF ((Date >= DATE("Jul 18, 2016")) AND (Date <= DATE("Jul 21, 2016"))) THEN "Republican National Convention"
ELSEIF ((Date >= DATE("Jul 25, 2016")) AND (Date <= DATE("Jul 28, 2016"))) THEN "Democratic National Convention"
ELSEIF ((Date >= DATE("Sep 10, 2016")) AND (Date <= DATE("Sep 12, 2016"))) THEN "Clinton abruptly leaves 9/11 service due to medical issues"
ELSEIF ((Date >= DATE("Oct 6, 2016")) AND (Date <= DATE("Oct 8, 2016"))) THEN "Recording released of Trump explaining that he likes to grab women by the pussy and that he ges away with it"
ELSEIF ((Date >= DATE("Oct 28, 2016")) AND (Date <= DATE("Oct 30, 2016"))) THEN "Comey announces new investigation into Clinton's emails"
ELSEIF ((Date >= DATE("Nov 7, 2016")) AND (Date <= DATE("Nov 9, 2016"))) THEN "Trump wins the election"
ELSE "" END

Actual tooltip:

Date: <DAY(Date)>
Donald Trump: <SUM(Donald Trump)>
Bernie Sanders: <SUM(Bernie Sanders)>
Hillary Clinton: <SUM(Hillary Clinton)>
Ben Carson: <SUM(Ben Carson)>
Ted Cruz: <SUM(Ted Cruz)>
John Kasich: <SUM(John Kasich)>
Marco Rubio: <SUM(Marco Rubio)>
Jeb Bush: <SUM(Jeb Bush)>
<ATTR(Tooltip)>

Screenshot of the setup:


And that's it.
      edit

1 comment:

  1. 💎 IPRO356💎
    📢 Number 1 casino, easy to play, fast 📢
    🔥 Come and win bonuses before you grow up, only here.
    🎮 Slots, baccarat, shooting fish, cards (ace card) are all finished in one place.
    ⚽️ Football fans must be at IPRO356 only. Clear the bill quickly and pay immediately.
    💎 Sign up for free, no fees.
    📱 Support all mobile phone systems, both android and ios.
    ⚖️ Deposit - withdraw. No minimum. No need to make a turn.
    💸 There is a formula to give away for free with a group to play.

    ReplyDelete