4 Replies Latest reply on Mar 15, 2012 8:53 AM by Shawn Wallwork

    2 Questions about reference lines & axis...

    Shawn Wallwork

      More than once I've posted an Idea, only to have Joe explain how to do it. So this time figured I'd post here first.


      I've got a simple viz using Joe's reference line trick to get 'grand totals' to show in a bar chart. Problem #1: The dynamic sizing (automatic) axis doesn't put enough padding at the end of the longest bar, so the total is truncated:




      Of course if I fix the axis at 600M it works fine, but when years are eliminated the axis is too big. Problem #2: Overlapping text when only one year is selected:



      Both the ref-line and the label are showing the same figure. Of course I'd rather only one of them show. I've got a hunch that this one has a solution, I just can't figure it out. Workbook attached.

        • 1. Re: 2 Questions about reference lines & axis...
          Peter Hopwood



          Hmm this is a weird one - I've never come across this problem before.  I read your question and thought that these should be easy to fix but I can't find a Tableau solution at the moment.


          My thoughts would be to create a year column in the data and then create a 'value' so that each row just has data  for a particular year.


          I'm guessing that as each of the measures has a separate 'range' of values that Tableau is struggling to work out that these three columns are in effect the same thing for a different year - which is causing these issues.


          What flexibility do you have in the source data?


          I'll keep playing around to see if I can work out another way.



          1 of 1 people found this helpful
          • 2. Re: 2 Questions about reference lines & axis...
            Shawn Wallwork

            Pete, thanks for the quick response! Yeah, I sort of thought 'no problem, I'll just ....' ? An hour later I was still looking for the 'just'. In answer to your question: Yes I probably can reshape the data like you talked about, 12,500 rows x 3 years, should fit. Sort of liked the measure broken out by year, it seemed different and interesting to work with them that way, at least until I hit this snag.


            Thanks again for taking a look.



            • 3. Re: 2 Questions about reference lines & axis...
              Jonathan Drummey

              Hi Shawn,


              I took a look at this as well. I've never used Measure Values as a Reference Line, and I've never seen it mentioned, so based on my (limited) experience I'm guessing that there's some odd behavior around the edges. For example, if you change the reference line to per pane or per table, when you have only one year selected there are no overlapping labels as there are when the reference line is per cell.


              I think the problem with the reference line label being cut off is pretty clearly a bug. On Sheet 3, if you resize the Marks card and watch the view as it resizes, the reference line label stays at $55, until the Marks card gets super small and then it goes to $556.


              Another idea I had was to use Zach Leber's suggestsion about using stacked bar totals as a discrete dimension to label the bars in the comments of this post http://www.thedatastudio.co.uk/blog/text-label-beyond-default, however given how the data is set up I can't figure out how to make the total work properly when Measure Names is filtered. (Yet another case where access to Measure Names/Measure Values in calculated fields would be useful). I imagine if you reshaped your data this would all be a lot easier.



              1 of 1 people found this helpful
              • 4. Re: 2 Questions about reference lines & axis...
                Shawn Wallwork

                Morning Jonathan,


                Yep I was quite surprised when I discovered you could use 'Measure Value' as a reference line. So there is a variable for this after all. Now if they'd just let us use it in calculated fields! The other thing that could have helped is if we had multiple selection parameters.


                But after much head-banging, I finally came up with a solution...


                Problem #1 I change the number format to millions with zero decimals:


                Which fits within the padding for all but the smallest size screens.


                Problem #2 I changed the bar label font color to white (with dark color bars). So now when only one year is showing and the labels overlap, the bar labels are hidden against the white background:



                The things we do for love.... (of Tableau)




                EDIT: One quirky little thing is the order of colors in the bar chart and in the legend. Look at the Problem #1 pix and you'll see that to get the bars to run sequentially from 2009-2011 left to right, I have to order the colors in the legend upside down. It's the little things that make a difference...


                Message was edited by: Shawn Wallwork