12/29/2015
Visualizing Time on a Clock in Tableau

I've spent the last few days working with my daughter on her science project for next month's science fair. She is experimenting with different types of forced patina on copper pipes. Part of the experiment is measuring time. She's recorded time for the various methods and so we opened her laptop and started playing with the data on Tableau Public. We created a bar chart which she was happy with and so she moved on. However, I started thinking about other ways to visualize the data that she had. She was measuring hours and minutes and so I started thinking about showing this on a clock. I decided to try some alternatives in Tableau. Click on the image below to see on Tableau Public.

I ended up visualizing time on a clock with a few variations that might be useful in certain instances. I created variations for hours and minutes as well as an example of times for a workshop. The later might work better as a simple gantt chart in a linear form. Even so, I have outlined the steps below.

### Step 1: The Data

The data is very straight forward. You can download a sample Excel workbook here. If showing something in hours then each category would add up to 12 hours. If showing minutes, then the total for the category will be 60 minutes. The "blank" row in each category is for whatever portion of the clock that isn't highlighted. The "position" column is a dummy number that is used to place everything on a dual axis at the same point. I used a stock image of a clock here that I found online, but any image of a clock could be used or easily created in Adobe Photoshop or Illustrator.

### Step 2: Building the Viz

Move "category" to columns
Move "category" to filter and select "example 1" (this is specific to this sample data)
Move "position" to rows and change Measure to "average"
Repeat step to create another green pill on the rows
Click on the second green pill for AVG(position) on the rows and select Dual Axis
Right click on the secondary y-axis and select Syncronize Axis
Select the first AVG(position) on the marks card and select custom shape using a clock image
Select the second AVG(position) on the marks card and select Pie
Move "slice" to Color
Move hours to Angle
In the slice color legend, move "slice 1" up to the top of the list. This will move the slice to start at noon.
Change the color of "slice 1" to desired color
Change the color of "blank" to white (or other desired color)
Click Color and set the transparancy to 30%
Hide all of the axis labels and headers

You should now have a highlighted selection on the clock image.

### Step 3: Various Options

Select the Size on the second AVG(position) marks card and increase the Size to highlight a slice outside of the clock or smaller to bring it inside of the circle.
If increasing the size to show outside of the circle, then another option is to move the first AVG(position) on the rows to the second position. This will create a sort of donut wedge outside of the clock without highlighting anything inside of the clock.