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 x-axis serves as a timeline while the y-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 a 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 create your first line chart with Datawrapper. The line charts you can create are feature rich and fully responsive, meaning they will adapt to different screen sizes. Plus, in this particular example we have an interesting story, too. "How the iPhone Shaped Apple".
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 follows.
You can copy the full data from a Google Doc we prepared: Here's the dataset.
Note how the data set should be structured:
- One header row containing labels
- The first column defining the x-axis
- The following columns contain values that define each line and the length of the y-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 detects date formats which are text in the spreadsheet.
In the following columns, you can create categories that will be represented by one line per column. Once your dataset looks like this, you can copy it into Datawrapper and click "Upload and continue".
2. Check & Describe
As you can see, Datawrapper automatically detects empty cells and did assign null-values. These will simply not be charted so you don't have to worry about them. You will also notice that Datawrapper automatically idenfies the values of the first column as date data.
Finally, make sure that the box "First row as lable" is ticked so that Datawrapper correctly assigns the values to the labels. Click on "Proceed" and Datawrapper will take you to the next step.
The chart type to choose here is the " Lines". Experienced users of Datawrapper will know that, but if you just started 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 Refine, Annotate, and Design. We cover this in a separate short tutorial found here.