Why won’t my long text wrap?  Annotation Tricks!

Why won’t my long text wrap? Annotation Tricks!

Oh transparent worksheets, where are thou?

I recently came across a situation at work where I was designing a Tableau dashboard and wanted the user to interact by using the dropdown parameter for a dimension.  I had an important paragraph of text to display with each selection.  I wanted to make this paragraph stand out by making the background of the sheet change with the color of each dimension.  No problem, right?

Here is an example using the days of the week and some text from Wikipedia.

Many people already know the trick where you create a bar on MIN(Number of Records) with a fixed axis of zero to one, dial size all the way up, and the add your label.  This is shown below.  This works great…when the label is short.

2016-09-24_12-24-40
Click to enlarge.

What happens when you want to do the same thing with longer text, say an entire paragraph?  No problem, I’ll just do the same thing and it should work.  Wrong!  Tableau will not wrap the text of the mark when it is on a continuous axis.

Click to enlarge
Click to enlarge

If your like me, you’re probably saying oh just select wrap text in the label options…if only that worked!

Click to enlarge
Click to enlarge

Ok, Tableau you will do what I command.  Time to get creative!

Create a sheet using MIN(Number of Records) on columns, add your dimension to the marks card, but right click on the dimension and select Minimum under measure.  Before, you fix the axis from zero to one, right click on the bar and select annotate mark.

Click to enlarge
Click to enlarge

Add MIN(Dimension) to your annotation.  Tableau will place the annotation in the space to the right of the bar as shown below.  You can drag it on top of your mark and then fix the axis.  Format the Annotation as shown.  Drag the annotation so it is the width of the bar, but do this from the dashboard.  Now, this text will change with your parameter and you only had to setup one annotation.

Click to enlarge
Click to enlarge

All that is left is to click through and setup your colors.  Thanks to Rody Zakovich for showing me that MIN() trick this week!  It made my annotation fix even better.   Here is the viz to see it in action.

One thought on “Why won’t my long text wrap? Annotation Tricks!

Leave a Reply