Timelines
Data Visualization and Design  CUNY Graduate Center  Summer 2019
Goals
 Decide what kind of timeline fits your data.
 Explore advanced functions of Tableau
Data
Women’s Soccer Top Goal Scorers
Timeline (Basic)
We pulled this table from Wikipedia using the formula in cell A1. To save as an Excel file without the html formatting, I copied all of the contents and used Paste Special >> Text to save the text in an Excel file. Then did a little cleaning to remove footnotes, etc.
Timelines are not built in to Tableau by default. The trick is to tell Tableau when to begin.
We want to know when the top female goal scorers scored their 100th goal.
 Load the Women’s Soccer Top Goal Scorers Dataset
 Change the datatype of the Date of 100th Goal from String to Date
 Create a Calculated field to specify the beginning.
MIN(0)
Name your field "CALC: Beginning"  Drag CALC: Beginning to Rows
 Drag Date of 100th Goal to Columns
 Use the drop down menu to make the Date Continuous and broken down by Day (not Year)
 To display events on the timeline, drag Name to the Details and National Team to the Tooltips. You should have points along the timeline noe.
 Note that there were some players with unknown dates. These players must be represented somewhere on the visual – generally with an annotation or footnote.
 Format based on your preferences – I prefer to have a thicker zero line, larger points, and to edit the tooltips
Gantt
Gantt charts are best for showing duration, overlapping time periods, and the beginning and ending of events. They are often used in project planning, but are also a great way to show when the best women’s soccer players overlapped with each other. We want to know when these 17 allstar soccer players played, and be able to answer: Who played with/against whom when?
 First split the duration on the hyphen. An automatic split should do this for you. This will give you a column with start dates. Change the datatype of both split columns to dates
 Calculate the duration of play
DATEDIFF('year',[Active years  Split 1],[Active years  Split 2])
Call this field ‘CALC: Duration’  Drag the Active years – Split 1 to Columns. Click the dropdown arrow and select Continuous and Years (in the first set of years)
 Drag Name to Rows
 Years are indicated by tick marks.
 Drag CALC: Duration to size on the marks card and change the Aggregation to Average
 Drag National Team to color on the marks card
 Drag Active Years to the Tool Tips
 If you have too much to show, drag Active years – Split 1 to the Filters and specify a narrower range of years.
 To sort by year they started playing, go to Name in the Rows shelf, and select ‘Sort’. Sort by Active years – Split 1 and Minimum
 Assign Colors, edit axes, format tooltips.
Spiral Timeline
Based on this tutorial
Now we will turn our attention away from sports toward Trump’s tweets during the first year of his presidency. This dataset comes from the Trump Twitter Archive
We’re just going to look at 2 years of data, though you can, of course, look at much larger segments. In order to plot the spiral we need to know two things for each tweet:
 How far through the year is the given day? This will determine the angle of the plot and how far round the circle we want to plot the data.
 How far away from the start (first tweet) is the given day? This determines the distance of the plot from the centre (without this, all the plots from each year would overlap).
So we use the datepart function to get the day of year from 0 to 365

So we use the datepart function to get the day of year from 0 to 365. Create a new Calculated Field with the following equation:
DATEPART('dayofyear',[Created At])
Name your field CALC: Day of Year 
Now figure out how many days each datum is from the start of data collection (i.e., how deep into the dataset is it). Create another field:
((YEAR([Created At])  2017) * 365) + [CALC: Day of Year]
Name your field CALC: Total Days 
Next, the angle. We know that each day is 1/365th of the way round the circle. Tableau uses radians, but all you need to know is that there are (2 x π) radians in a circle. So the angle is however many 365ths of the year have elapsed, times (2 x π) Create another field:
[CALC: Total Days] / 365 * 2 * pi()
Name your field CALC: Angle 
Calculate X and Y using trigonometry (I warned this is an ADVANCED visualization):
([CALC: Total Days]) * (COS([CALC: Angle]))
CALC: X([CALC: Total Days]) * (SIN([CALC: Angle]))
 Drag ‘CALC: X’ to Columns and ‘CALC: Y’ to Rows, and Text to detail
 It’s a little tighter than we want. We’ll fix this with parameters. Select the drop down menu from the data pane and select ‘Create Parameter’ create one Parameter called ‘Parameter’ and set it to 4. Create a second Parameter. Call this ‘Inner’ and set it to 35.
 Return to edit CALC: X. The new Formula is:
([Inner] + [CALC: Total Days]/[Parameter]) * (COS([CALC: Angle]))
The new formula for CALC: Y is:([Inner] + [CALC: Total Days]/[Parameter]) * (SIN([CALC: Angle]))
 Drag the Retweet count to Size & Source to Color

Edit the colors as you like, clean up the tool tips, remove the axes, and give it a title.