Example
There are a variety of ways to download and use D3.
Direct Script Download
- Download and extract d3.zip
- Copy the resulting folder to where you will keep your project's dependencies
- Reference d3.js (for development) or d3.min.js (for production) in your HTML:
<script type="text/javascript" src="scripts/d3/d3.js"></script>
NPM
- Initialize NPM in your project if you have not done so already:
npm init
- NPM install D3:
npm install --save d3
- Reference d3.js (for development) or d3.min.js (for production) in your HTML:
<script type="text/javascript" src="node_modules/d3/build/d3.js"></script>
CDN
- Reference d3.js (for development) or d3.min.js (for production) in your HTML:
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.1.1/d3.js"></script>
GITHUB
- Get any version of d3.js (for development) or d3.min.js (for production) from Github :
<script type="text/javascript" src="https://raw.githubusercontent.com/d3/d3/v3.5.16/d3.js"></script>
To link directly to the latest release, copy this snippet:
<script src="https://d3js.org/d3.v4.min.js"></script>