🌍 Public
Viewing a saved revision (read-only)
23e7573b623d4138880c0e68b047770f
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