In my previous post on labeling trellis chart, I only showed how to label at the top left corner. People like Chipo Chirewa may want to label elsewhere.

Here I would show how to label anywhere in a trellis cell, like places other than the top left corner.

Vertical Alignment of Labels

In the demo workbook of the previous post, the label height is determined by the axis field

  • Window_Max(1) 

with fixed vertical axis range from 0 to 1. This places the data mark at the top.

Given the same axis range from 0 to 1, Window_Max(0.5) places the data mark in the middle and Window_Max(0) places the data mark at the bottom.

In the demo workbook for this post, we use a parameter for the vertical alignment which has possible values in (1, 0.5, 0).

Horizontal Alignment of Labels

In the demo workbook of the previous post, the label field formula is as follows

  • IF First()=0 Then Window_Max(Max(Country Name)) End

This places the label on the left. For placing the label on the right, we should write the formula like

  • IF Last()=0 Then Window_Max(Max(Country Name)) End

For placing the label in the center, we can write the formula as follows,

  • IF Index()=Int(Size()/2) Then Window_Max(Max(Country Name)) End

Size() computed along Date is the number of months. Size()/2 gives approximately the center position of the data mark, depending on even or odd number of months. To fine-tune the position of the mark, we added a parameter Horizontal Offset with values from -10 to 10. Then the formula becomes:

  •  IF Index()=Int(Size()/2)+Horizontal Offset Then Window_Max(Max(Country Name)) End

Another way to fine tune the horizontal position of the label, is to insert spaces before the label.

Note that we need to set the alignment for the label to be Middle-Center in Tableau:

We use a parameter for the 3 horizontal alignment options.

Here is the link to the demo workbook. With the horizontal offset, we can place the labels anywhere horizontally. If we wish, we can add a vertical offset as well. Basically, it's possible that we can place a label anywhere. 

In general, a design only needs a single option. You just take one of the options above. It should work out.

Feel free to leave comments below or contact me at twitter @aleksoft.
3

View comments

(Refresh the page if you want to view the gif image multiple times. Or go to Tableau Public and click the button at the top-right corner.)

Jake and I collaborated on a dashboard. He told me that he learnt a way to create an in-place help page in Tableau. He first saw it at a conference somewhere and couldn't recall who the speaker was. So I am blogging here about it but the credit goes to somebody else. If anyone knows who the original creator is, leave a comment below.

The key idea is to float a semi transparent worksheet on top of the dashboard, where a help text box is strategically placed on top of each chart. This way, we can explain how to view each chart and what data points are important, etc. This worksheet is collapsible by a show/hide button. 

Below I would like to show how this worksheet can be constructed.

1. Sheet with a single data mark.

  • Double click the empty space in Marks panel and add two single quotes. Make the null pill a text label. This creates a single null mark.
  • Set the view as "Entire View"

2. Create an show/hide button

  • Go to the target dashboard
  • Drag a floating vertical container to the dashboard, making it cover all the area of interest.
  • Drag the Single Null Mark sheet and drop it into the above container. Hide the sheet title.
  • Create an open/close button for the container and place the button at the top-right corner.

3. Add annotations

  • Format the sheet background opacity as 70% in the layout manager             
  • Select area annotations and place them anywhere of interest. 
  • Write help text and format it to highlight important messages.  
  • The text can serve as functional guide and/or insight guide.

Here is an example. Feel free to download the workbook and explore. Click the "i" button at the top-right corner to view the in-place help. 

0

Add a comment

Blog Archive
Loading
Dynamic Views theme. Powered by Blogger. Report Abuse.