See scottmurray.org for the latest, including a new book project. This website is not current and will be retired at some point.
These tutorials address an older version of D3 (3.x) and will no longer be updated. See my book Interactive Data Visualization for the Web, 2nd Ed. to learn all about the current version of D3 (4.x).
Start by creating a new folder for your project. Within that folder, I recommend creating a sub-folder called
d3. Then download the latest version of d3.v3.js into that sub-folder. As of this writing, the current version of D3 is 3.4.2.
D3 is also provided in a “minified” version, d3.v3.min.js, from which whitespace has been removed for smaller file sizes and faster load times. The functionality is the same, but typically you’d use the regular version while working on a project (for friendlier debugging), and then switch to the minified version once you’ve launched the project publicly (for optimized load times). The choice is up to you, but in these tutorials we’ll be using the standard version.
Create a simple HTML page within your project folder named
index.html. Your folder structure should now look something like this:
project-folder/ d3/ d3.v3.js d3.v3.min.js (optional) index.html
Now paste the following into your HTML file, so it references D3 in the
In some cases, you can just open your HTML file in a web browser to view it. However, when loading external data sources, it is more reliable to run a local web server and view your page from
http://localhost:8888/. You could use a server like MAMP or see the notes on the wiki on activating a quick, temporary server.
Next up: Adding elements →
These tutorials address an older version of D3 (3.x). See my book Interactive Data Visualization for the Web, 2nd Ed. to learn all about the current version of D3 (4.x).
Download the sample code files and sign up to receive updates by email. Follow me on Twitter for other updates.
These tutorials have been generously translated to Catalan (Català) by Joan Prim, Chinese (简体中文) by Wentao Wang, French (Français) by Sylvain Kieffer, Japanese (日本語版) by Hideharu Sakai, Russian (русский) by Sergey Ivanov, and Spanish (Español) by Gabriel Coch.