Skip to main content
100%

Inject d3

✓ Published0🌍 Public
11wheel
Last edited Mar 30, 2021
Created on Feb 2, 2015

This example demonstrates a live injection of a custom D3 build into a page, showing how the library can be loaded dynamically at runtime. It creates a new script element and sets its `src` to a remote D3 file hosted by the author, then appends that element to the document body. The visualization itself is not rendered in the code; instead, the focus is on the loading mechanism. The snippet uses the browser’s DOM API (`document.createElement`, `appendChild`) to fetch and execute the external script, making D3’s methods available for subsequent use. The source is a gist by 1wheel, and the loaded file appears to be a custom D3 build.

AI-generated description
var script = document.createElement("script")
script.src = 'https://roadtolarissa.com/worlds-group-2017/d3_.js'
document.body.appendChild(script)

Similar vizzes