Automatic chart updates: 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 feature is set-up all you need to do is uploading the newest data to a server which is connected to the specific chart or map.
This is specifically important for very timely data: At the moment the .csv is updated, every user who clicks on the chart after the update instantly gets the newest data.
Enabling this feature for your account
This feature is available to paying Datawrapper users. We need to enable this option for specific accounts (Single or Team). Once this is done, you'll see this additional option in step 1 (Upload). Check out our set-up requirements below. The concept here is that we need to ensure that the data going into charts is from a validated resource and uses HTTPS.
Tell us via email@example.com
Preparing your .csv
We recommend to test the charts which should later become updated automatically and ensure that your .CSV structure has the data needed for either a specific chart types or a map. With maps to be updated properly the naming of the specific regions is important. (Example: In the UK election constituencies might be written either St. or Saint - here it is advisable to use the descriptions which are listed in the Datawrapper map, otherwise the data won't be parsed).
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> <AllowedMethod>HEAD</AllowedMethod> <MaxAgeSeconds>3000</MaxAgeSeconds> <AllowedHeader>Content-*</AllowedHeader> <AllowedHeader>Host</AllowedHeader> </CORSRule> <CORSRule> <AllowedOrigin>https://*.dwcdn.net</AllowedOrigin> <AllowedMethod>GET</AllowedMethod> <AllowedMethod>HEAD</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:
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.