How to deal with missing data in line charts

Sometimes, missing values in a line chart or multiple lines charts will create gaps in your line(s). This can happen if you want to 

  • combine data sets with different dates of reporting (e.g. monthly and quarterly data)
  • show events of two or more categories that happen on different dates (e.g. world records or cumulative successful and failed rocket launches)
  • connect patchy lines with missing data points.

This article explains how to create continuous lines and how to communicate your original data gaps. 

How to connect all data points

In Datawrapper, you can connect all data points with one click. In line charts or multiple line charts, go to step 3: Visualize > Refine > Lines and then turn on Connect all points below Interpolation:

This will connect all existing data points in all lines and also work with area fills. 

If you want to connect all points of just one or a few lines in your chart, you can also select those below Customize lines and then click on Connect all points of the selected line(s):

How to keep gaps in lines 

When you have missing data points, you can’t always assume that the data developed smoothly between the data points that exist. The missing data might be strong outliers. To not potentially mislead your readers, you can keep gaps in your line(s) even when connecting data points. Simply put some text like “NA” or “–” in your data set: 

How to show your connected lines well

To help your readers to know where your gaps are, we recommend tweaking the design of your line charts. Here are some ideas. They won't work with all data sets, but with some:

1. Show all line symbols

The most intuitive way to make visible where your actual data points are is to show  line symbols on all data points. Line symbols exist in both line and multiple lines charts. (You'll note that they only work well below a certain number of data points per line.)

2. Turn on stepped interpolation

Depending on the data, a stepped interpolation can also make the intervals between your data points nicely clear. There are three kinds of stepped interpolation. We recommend Steps (after) or Steps (before).

  • Steps (after) will draw a straight line to the right of a data point. That line goes 90 degree up or down on the x axis position of the next data point. 
  • Steps (before) will draw a straight line up or down to the y axis position of the next data point immediately, and then turn 90 degree to draw a straight line right to the next point. 
  • Steps will draw the downwards/upwards line in the middle between the two data points. They're not useful for making visible where your data points are.  

3. Use dashed lines for assumed lines

Another way to differentiate parts of the data that were collected and those that were assumed is to use a combination of solid lines and dashed lines:

Here's how to achieve this:

  1. Go to step 2: Check & Describe and click on Add column at the bottom. Give that new column a name and type in or paste in the values you want Datawrapper to connect with a dashed line. You might want to make use of the "NA" trick explained above for your actual line. 
  2. Now go to step 3: Visualize > Refine. Find and select the new column = line below Customize lines. Now give it the same color as your main line (City A, in our case), turn on Connect all data points and give it a dash. Finally, deselect Next to line (and As legend) as the label options to make sure that the name of the new column doesn't turn up anywhere. 

And that's it – you now have a chart with dashed lines.


If you have any questions or better suggestions, reach out to us at support@datawrapper.de.