🌍 Public
Viewing a saved revision (read-only)
05bf7817c2e4428a9c99e37fc5ac34c2
Svelte + D3: Datawrapper Web Component
This example demonstrates how to embed a Datawrapper chart in a Svelte application by creating a reusable web component. The code loads a Datawrapper visualization using the chart ID `EdaYj` through the `https://datawrapper.dwcdn.net/{id}/embed.js` script, with a fallback image for environments where JavaScript is disabled. The App component imports and renders the Datawrapper component, while the project configuration includes D3 as a library dependency, though the embedded chart’s data and rendering are handled entirely by Datawrapper’s external service.
AI-generated descriptionInclude a Datawrapper chart