Sparkline Chart in Tableau
What is Sparkline
A sparkline is a compact trend line chart without axis that fits in a small area and shows values over time.
The sparklines show trends that they visualize time-series data, sparklines are line charts, they are without axis which means they do not start at zero, and they are compact which means that they are intended to fit in a small area and are mostly used for indicative purpose of the trend and changes over the period of time.
How to make sparklines in Tableau
Sparklines are easy, and (dare I say?) fun, to create in Tableau. If you would like to follow along, I am using the Sample – Superstore dataset that comes out of the box with Tableau.
Set up to basic line graph
Drag Order Date to Columns, expand it to quarterly
Drag Sales to Rows
Drag sub category on Rows
We will get a graph for each individual sub category
As you can see, each subcategory is scaled from 0 to 30k. For instance, look at Art, it will never get up to as highest at 30K so it is very difficult to see the trend in Art. To overcome this problem, we need the high point and low point for each sub category, so that they have different scale for each item.
For that, follow the steps.
Right click on Sales Axis and select Edit Axis
Select Independent axis rows for each row or column and click OK
Uncheck Include Zero
Now, we get much clearer trends within each cell. By taking out ‘Include Zero’, it is not we want to understand that Art is necessarily higher than Accessories in Q4. However, we do want to understand what the trend is and how it is moving over the time.
To get the view to look as it does below, I chose the ‘MONTH’ option. We have now essentially made a series of line graphs, but they are not very ‘sparky’, making it difficult to get insights.
Resize and make sparklines compact
Reduce the thickness of the sparkline
Keep the top header and remove header from bottom
Remove the scale and Y-axis
To make the trend pop up we need to do some clean up. We are going to remove everything that we possibly can in order to make the trend the star.
Go to format
Remove all the Grid lines
Remove all the borders
It shows the trend rather than the individual number if you, hover over the number obviously you will still get them. Now you cannot see the individual numbers but, you can see, the trend change from year to year and whether the trend is different for different products.
But also, sparklines violate the most fundamental rule of data visualization : They do not start at zero. So use them cautiously. As there is no equal axis (each axis starts at a different scale then another sparkline) you cannot directly compare one sparkline with another, but you can see seasonal patterns among different sparklines and do the comparisions.