How to install D3.js


D3.js is a JavaScript library for visualizing data using web standards. D3 helps you bring data to life using SVG, Canvas and HTML. D3 combines powerful visualization and interaction techniques with a data-driven approach to DOM manipulation, giving you the full capabilities of modern browsers and the freedom to design the right visual interface for your data.


You can download the latest version of D3.js from the GitHub releases or use a D3.js CDN. The released bundle supports anonymous AMD, CommonJS, and vanilla environments.

Cloning a repository

You can clone a repository from to your local computer.
Cloning with HTTPS URLs
git clone
Cloning with SSH URLs
git clone [email protected]:d3/d3.git
Cloning with GitHub CLI
gh repo clone d3/d3

Install via NPM package

Run the following command to locally install the package and its dependencies with NPM.
Next Version:6.0.0-rc.4
Publish Time:2020-08-24 07:21:58
Unpacked Size:0.93 MB
Downloading and installing packages locally
npm i d3
npm install d3
yarn add d3
Downloading and installing packages globally
npm i -g d3
yarn global add d3
Install Specific Version of a Package
npm install [email protected]
bower install d3


Code 1: - D3 is written using ES2015 modules. Create a custom bundle using Rollup, Webpack, or your preferred bundler. To import D3 into an ES2015 application, either import specific symbols from specific D3 modules:

import {scaleLinear} from "d3-scale";

import * as d3 from "d3";

const d3 = require("d3");

const d3 = Object.assign({}, require("d3-format"), require("d3-geo"), require("d3-geo-projection"));