Publishing charts with external data sources

Datawrapper has an option to update charts automatically, without republishing. This can be used e.g. in election nights, when you get new data every hour and want to avoid that all charts have to be re-published. Once this is set-up all you need to do is uploading the newest data to a destination (see below). Every user who clicks on the chart after the update instantly gets the newest data.

Set-Up

Your external data file needs to be publicly accessible under a URL that supports cross-origin resource sharing (CORS) and HTTPS. The data file will be requested every time the chart loads, so make sure to host it on a server that can deal with high traffic.

1. Upload the data to a CORS-enabled HTTPS-ready CDN

If you are using Amazon S3, you can copy this CORS configuration:

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
    <AllowedOrigin>https://datawrapper.de</AllowedOrigin>
    <AllowedMethod>GET</AllowedMethod>
    <MaxAgeSeconds>3000</MaxAgeSeconds>
    <AllowedHeader>Content-*</AllowedHeader>
    <AllowedHeader>Host</AllowedHeader>
</CORSRule>
<CORSRule>
    <AllowedOrigin>https://datawrapper.dwcdn.net</AllowedOrigin>
    <AllowedMethod>GET</AllowedMethod>
    <MaxAgeSeconds>3000</MaxAgeSeconds>
    <AllowedHeader>Content-*</AllowedHeader>
    <AllowedHeader>Host</AllowedHeader>
</CORSRule>
</CORSConfiguration>

2. Create a new chart and select "Link external data"

In the lower left corner of the data upload step in Datawrapper, click the new button that says "Link external data"

Then enter the URL of the data file you uploaded. For testing purposes you can use this URL:
https://static.dwcdn.net/test-data/movies.csv

Datawrapper will immediately test if URL is configured correctly. If everything is green, you're ready to go. 

3. Create the chart as usual

In the describe step you will now see the dataset, but you won't be able to edit the data. However you can still transpose the data or compute new columns.

When the chart is published, it will always load the data from the URL you entered.

Still need help? Contact Us Contact Us