Line Charts and Time Series Data
Displaying data over time is a common requirement for analysis and reporting (often displayed as line charts). This includes exploring trends by year, quarter, month and week as well as comparisons across a period such as year-on-year and year-to-date. It may be necessary to explore trends by day or hour, which could be relevant to industries such as customer service and call centre analytics.
Visualising how metrics change over time enables business users and decision makers to quickly establish trends in seasonality and identify the direction of travel by spotting growth or decline in performance. This helps provide insight in what to expect and when, acting as a benchmark for tracking performance.
A popular way to show data over time is through line charts. However, when faced with visualising categorical data, line charts are not always the most effective option. This post suggests six alternatives, using data on Coronavirus cases across UK regions (up to 26/09/2020) . The charts are built using Microsoft Power BI Desktop but you can apply these tips to other tools such as Tableau or Excel.
The aim of this post is not to provide specific details on each chart type or to disregard line charts as an option. Instead, the purpose is to give an overview of some possible alternatives which could be more effective, depending on the requirement and type of data.
Considering Line Charts…
Line charts represent data points connected by a continuous line, the X-axis is the time frame and the Y-axis is the metric in question. In this example, the number of new COVID-19 cases in the UK is shown by Week End Date:
Line charts are popular, and rightly so. They are easy to interpret and identify changes in the data as the line moves up, down or remains flat. They are customisable, often overlayed with bar charts to display multiple metrics on the same graph. Line charts can be customised in the following ways:
-Enhance the data point (‘marker’) size
-Different line styles (dashed/dotted/solid/stepped)
-Lines can be stacked or overlapping
-Addition of trend or average lines, as well as annotating specific data points to provide further insight
However, line charts can be challenging when visualising categories. Categorical or nominal data i.e. distinct groups with no logical order, can be difficult to present at the best of times, especially when there are many categories*. Visuals can easily become overwhelming, making it difficult to identify any pattern or meaning. For example, the chart below shows the number of new COVID-19 cases by Week End Date and Region. We can see each region follows a similar trend, with the North West having the highest increase from August to September. But the pattern is not especially clear for each region, particularly between June – August where the regions overlap.
*TIP: you can filter on the Top N when there are too many categories/sub-categories or use hierarchies within tables to drill into further detail. One may consider ‘Too many’ to be 10+ categories but this is dependent on the requirement and data.
There is not always a right or wrong answer when visualising data. Depending on the requirement and the number and distribution of categories, line charts may still be a sensible choice. Below are six alternatives you might also want to consider. The aim is not to replace line charts, but it is always sensible to have a range of charts to choose from when making decisions on the most appropriate visual.
1. Spark Lines
At first glance, you may be thinking these are just normal line charts. And technically they are. However, spark lines  show separate lines for each category. The categories are presented as rows and can be ordered from highest to lowest; the example below is ordered by the total number of new COVID-19 cases over the time frame. They are also renowned for highlighting the min and max points (green and red) for each category. This visual pays less attention to the specific value of each point, instead focussing on the pattern of each category. This makes it easier to draw comparisons than with a traditional line chart.
It is worth pointing out the axis. The Y-axis in the visuals below is set to auto and therefore each category has a separate scale. This means that the highest points in the North West and West Midlands, for example, may look to have the same height but are vastly different values. This again is drawing attention to the pattern of each category but can be misleading in some cases.
2. Small Multiples
Another line chart? Technically, yes. Like spark lines, small multiples  show separate lines for each category, however, they are presented in a grid format. Again, the focus is on the pattern of each category and the ability to easily compare. The grid style makes this visual particularly useful with a higher number of categories and you can order it from highest to lowest. In this example, for comparison each category has the same Y-axis scale and we can therefore clearly see the regions with the highest and lowest volumes overall.
3. Stacked Area Chart
Stacked area charts are like traditional line charts, as shown above. However, there are some added benefits. As the categories stack on top of each other, the line at the top of the stack presents the total. Moreover, each category (and its associated colour) represents the proportion of the total. For example, we can see the North West makes up a larger proportion of new cases in September compared to May. While, the East of England has decreased as a proportion.
4. Ribbon Chart
A ribbon chart stacks the categories with the height of each bar representing the total. This is similar to a stacked bar chart with the added benefit of ordering the categories from highest to lowest at each point in time. You can therefore see the rank change for each category. For example, in July 2020 Yorkshire and The Humber had the highest number of new COVID-19 cases, while through May – June the North West had the largest. This visual is on the edge of having too many colours changing direction, so we aggregate the data to monthly. It is also important to mention the Y-axis does not appear on ribbon charts (a feature of Power BI), so we recommend using labels. However, this does mean we cannot easily see the total values.
5. Scatter Chart
A slightly different approach to visualising change over time is using a scatter chart. Instead of displaying variation each week or month, you can use scatter charts to show percentage growth over a period. This can be important as less prominent categories, in terms of absolute volume, may be experiencing significant growth/decline which could easily be missed in a line chart. Scatter charts can display multiple metrics at once, such as the size and colour of data points (the visual below is sized by cumulative cases up to 26/09/2020). They also enable users to quickly identify outliers which are over or underperforming. In the example below we can see the North East experienced by far the largest percentage increase in new COVID-19 cases from August to September.
Having said that, you lose exactly when the growth occurred. For example, in what week did the North East see the most growth? Has it been growing steadily within the month or was there a rapid increase which has since declined? Depending on the story you want to tell, this chart may benefit alongside another visual to add further context.
6. Highlight Table
Often referred to as a heat map, highlight tables display the values, category names and time range in a table format. The pattern in values (such as absolute or % growth) is represented by the colour intensity. Often with the darker colour meaning a higher value. They can be ordered from highest to lowest and can be effective with a larger number of categories, due to their ability to quicky draw the eye to the most interesting data points. Depending on the requirement and preference, data labels can be removed and row totals replaced with a bar chart.
Line charts can be a great way to show trends over time. But not always. Especially when visualising categorical data. This post has suggested six alternatives to consider: spark lines, small multiples, stacked area, ribbon chart, scatter and highlight tables.
Thank you for reading. Let us know the different ways you have visualised categorical data over time!