Only this week, get the SQL Complete Track of 9 courses in a special prize of $330 $89!
Visualize your data - line chart
3. Encoding data on a line chart
Work with your chart
Check yourself


We've already prepared the data for our line chart – we can use what used for the bar chart. Let's see how it looks on a line chart.

Encoding Data on a Line Chart

We can see that every row is encoded in a single point on the chart. The value of year (2005-01-01) determines the horizontal position of the point, and the value of consumption (4.14) determines its vertical position.

The most important element here is not the individual points but the differences between them. In the table, there are two rows circled (2001 and 2002), with the difference between them shown in red (2.71). This value is represented on the chart by the slope of the line between 2001 and 2002. The steeper the line, the more significant the change.

Don't hide missing values.

Sometimes you may have all the values in your time series – except for a few in the middle. The natural temptation is just to connect all the values you have in a solid line. Don't do this! It's misleading. Remember, the slope of a line between connected points gives us the impression of a change between both points. You can't fill in this data by guess; you don't know what happened between these points. It could have dropped quickly, fluctuated, or increased slightly. Your visualizations should always be accurate.