How to create a line chart

The line chart is ideal if you want to show trends and developments over time. One big advantage is that people will find a line chart easy to read and to understand. Commonly, the horizontal axis serves as a timeline while the vertical axis indicates values. By connecting these value points, Datawrapper creates a line chart. The more data points you have, the more accurate your line chart will be. Datawrapper can handle line charts with up to 1000 data points, after that threshold performance of many browsers slows down a bit - so try to stay below that number. 

This guide will show you how to get started with line charts. The line charts you can create are feature-rich and fully responsive, meaning they will adapt to different screen sizes. 

1

Preparing and importing the data

You can copy & paste data from Excel or the web, or upload your own CSV files. For example, here is the dataset that powers the chart of Apple's sales above the line. Your dataset should be formatted as following:

You can access the data displayed in the table above here.

To structure the data in Google or Excel Spreadsheet, you need to do the following:

  • Ensure there is one header row containing labels
  • Check that your first column is not empty as it will define the horizontal axis
  • The subsequent columns contain values that define each line and the length of the vertical axis

The first column should contain some kind of date or year data as it defines the length of the timeline. Make sure that these values are consistent. Datawrapper can import all kinds of date formats and even detect date formats which are expressed as text in the spreadsheet. Once your dataset has fulfilled these prerequisites, you can copy it into Datawrapper and click "Upload and continue" (For more in-depth information on how to clean your dataset before importing it into Datawrapper, read this excellent blogpost).

2

Check & Describe

As you can see, Datawrapper automatically detects empty cells and assigns null-values. These will simply not be charted so you don't have to worry about them. You will also notice that Datawrapper automatically identifies the values of the first column as date data.

If you don't want the empty cells to get shown as "0"s in the tooltip, replace " null" values with "N/A". For more details, read "My empty cells get displayed as zeros in tooltips". 

Finally, make sure that the box  "First row as label" is ticked so that Datawrapper correctly assigns the values to the labels. Click on "Proceed" and Datawrapper will take you to the next step.

3

Visualize

The chart type to choose here is the " Lines". Experienced users of Datawrapper will know that, but if you are a first time user, it is important to know that with the selection of this chart type, the options and features available for this chart will change in the sections titled RefineAnnotate, and Design. We cover further customization of line chart in a separate tutorial here.