# Data Visualization Foundations: Time

## Before working with time data, have you thought about its structure?

It may sound as trivial as just using a line chart and showing the trend over time, but let me give some examples on how you can benefit more from knowing your temporal data. Especially now that Qlik Sense 3.0 has a gorgeous line chart that can use the different structures of time.

First of all, we can look at how temporal data has certain characteristics that distinguish it from every other type of data. In geography we often talk about Tobler’s first law which states that “everything is related to everything else, but near things are more related than distant things.” In a similar way we can say that observations that are closer to each other in time may be more related to each other. This means that for temporal data we most often should sort a chart based on time rather than value. This can be illustrated in the bar chart examples below where I’m looking at downfall over a couple of days. It’s easy for me to understand that the downfall spans a couple of days as the rain starts slowly and then continues for some time until it comes to an end. If this bar chart was just sorted by values it would be harder for me to understand the relationship between the days.

Another characteristic is that temporal data often has a structure to it that we can use. For example using a calendar system we know that weeks, months, quarters etc. repeat themselves and therefore time can be visualized as cyclic. From this, we can search for patterns and see if changes in the data are periodic and repeat themselves.

Linear time vs cyclic time

When we talk about linear time: we have a start time, an end time and a certain amount of values in between. The amount of values depends on the level we aggregate the data on so we would get more values looking at the data on a monthly level compared to a daily. So if we have monthly data over five years we’re expecting 60 values. We can also say that when we get more time points we increase the amount of values.

For cyclic time we instead look at the structure behind time and see how many unique values are part of that structure. So in the case of months we know that there are 12 months per year and that if we increase the amount of years the amount of values will not increase. Instead we are changing the aggregated values. For example, a really cold January would stand out in a linear chart as something that goes against the trend. But in a cyclic chart it would not be as easily noticeable as it would just adjust the average temperature for that month. One way to get around this is to add in additional information in the visualization, such as the maximum and minimum temperature of the period.

In the pictures below you can see the difference between using a field that is a combination of Year & Week versus just using Week. Looking at the linear chart I can see the change of temperature over time and that some years seem warmer or colder compared to others. Looking at the cyclical chart with the weekly temperature it’s interesting to see that after the first weeks of the year the temperature suddenly drops after being on the increase.

## What's the right way to create date & time #dataviz? We investigate in today's #Qlik Blog post:

The important part to think of is how you create your structure and what type of cycles are interesting to look at. Would it make sense to look at values across weeks, months or quarters and to try to find periods within your data?

Time point vs time interval

When we look at the temporal data it’s also of interest to know if the value is a point or if it represents an interval. In the case of a point the aggregation often doesn’t matter as it’s never used. In the first chart below I have two different temperature fields and I’m just plotting the values as they are. There can only be one maximum and one minimum temperature per day. But in the chart below I have data on an hourly rate and I want to see the average temperature per day. Hence it makes sense to use the average function to get a good representative value.

Now that we know a bit more about time we can also start using time together with mapping. One example of this is the space-time cube which shows a three-dimensional visualization of the data. In this case, I’m going back to one of my favorite visualizations, Charles Minard’s map. In this version we can also see how the army moves not only over land, but also time. Thus we know that Napoleon’s speed getting to Moscow was slower than his retreat, we can also tell the period he stayed in Moscow.

I hope this was educational for you! We have made some great time and date additions to Qlik Sense 3.0 and it gave me inspiration to write this post.