6 Replies Latest reply on Jun 12, 2018 1:51 PM by Izzie Cosgrove

    Moving reference line/tooltip when hovering?

    Izzie Cosgrove

      Hi all,


      I've been searching for hours about this! I've found many threads and youtube vids etc but nothing that quite seems to match to what I want to do (or doesn't seem to work with my data).


      Using data from polls that ask Americans which party they'd vote for the upcoming congressional election, I have % data of which party was chosen the most in each poll etc

      (doesn't add up to 100 as they only ask between democrat/republican so there is 'don't know' or any third parties not included in the data)


      I have created a line graph which shows the % of each party chosen over time

      Screen Shot 2018-06-12 at 14.38.46.png

      I have configured my tooltip to include the data from both AVG dem and AVG rep

      Screen Shot 2018-06-12 at 14.39.42.png

      But I would like to create a reference line of some sort which displays the date and the tooltip for both the blue + red line, and the % values for both. If possible I would also like it to state "Democrat" or "Republican" at the top depending on which field's value is higher for that date.  If this can't be done in 1 'tooltip' for both lines then having 1 tooltip per line appear when hovering over the date would be fine too.

      I don't want the line to act in the way a normal highlighter would and grey out anything as I want it to work via hovering so there will always be 1 date "highlighted" at all times and so greying out everything else will not look appealing.


      (Please note: I have a filter which can switch between the population of Americans included in the polls- e.g. likely voters or registered voter, so if possible this would need to work on each version of the filter)


      Any help would be amazing!


        • 1. Re: Moving reference line/tooltip when hovering?
          Dylan Bergey

          For some reason, I'm not able to download your twbx file correctly. If this answer doesn't provide sufficient results, could you attach a csv or excel data file?


          If I'm understanding the problem and expected solution, I have an idea. You could create a third line graph in your chart - maybe make it thin and grey. This would be the average of the democrat/republican values, or some other aggregation that you would expect on the trend line.


          To show the party that has more votes, you could create a calculated field you will need to create few calculations.


          The first is a max calculation [Max] = Max({Exclude [Sub-Category] : Max({FIXED Year([Ship Date]), [Sub-Category] : sum([Profit])})}) . Substitute Ship Date with Date, and Sub category with party. This gets the max of the sums by part and Date.

          The second is [Max = Sum] = [Max] = sum([Profit]) this formula just tells just tells us when these two values match.

          The third is to get the name of party [Display Name] =  if [max = sum] = TRUE THEN ATTR([Sub-Category]) END


          In your tooltip for this new line, you can add the max calculation and the display name. This will ensure that the party with the highest votes get shown first, and their corresponding value. If you want the other party affiliation, you could do the opposite of these calculations, by substituting max for min.


          Does this get you where you want to go?

          • 2. Re: Moving reference line/tooltip when hovering?
            Izzie Cosgrove

            Try opening the file again.. I closed down Tableau just in case that was the issue.


            The problem I keep coming across is the specific data set I'm working with. So I kinda need you to see it! I can't seem to make these calculations work because it isn't a sum and they aren't in categories so it doesn't match up. Which is the issue I've had looking at previous posts so wanted to make my own so it was specific to the data.


            Let me know if you can re open the file? If not I'll try sending it again or something?

            • 3. Re: Moving reference line/tooltip when hovering?
              Dylan Bergey

              It looks like you are using a version above 10.4 which I have. That's the reason I couldn't download the file. I'm upgrading now, but it may take a few minutes.

              • 4. Re: Moving reference line/tooltip when hovering?
                Izzie Cosgrove

                Sure let me know as soon as you've seen it!

                • 5. Re: Moving reference line/tooltip when hovering?
                  Dylan Bergey

                  This gets you pretty close. I just created an average line based on Dem and Rep. I then created an if statement to display the name of the highest voting percentage by block, and put this into the tool tip. Finally to get rid of the auto highlighting, you put the sheet in a dashboard. You'll create an action highlight.


                  Let me know if this works for you.


                  To add to this, currently Tableau does not have the functionality to edit tool tips in a trend line.

                  1 of 1 people found this helpful
                  • 6. Re: Moving reference line/tooltip when hovering?
                    Izzie Cosgrove

                    Hmm I am not sure.


                    This is very helpful but not quite what I'm looking for... I want the bar to always be visible regardless of where on the page the mouse is (so for example if the mouse is below the data line and not actually over it, for the ref line to 'select/highlight' the data points above and below where the mouse is -without greying anything) I think like this? Are Democrats Or Republicans Winning The Race For Congress? | FiveThirtyEight