d3.js Installation


Example

There are a variety of ways to download and use D3.

Direct Script Download

  1. Download and extract d3.zip
  2. Copy the resulting folder to where you will keep your project's dependencies
  3. 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

  1. Initialize NPM in your project if you have not done so already: npm init
  2. NPM install D3: npm install --save d3
  3. 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

  1. 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

  1. 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>