O'Reilly logo

Practical Data Analysis - Second Edition by Dr. Sampath Kumar, Hector Cuesta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Getting started with D3.js

First, download the latest version of D3 from the official website at http://d3js.org/.

To go directly to the latest release, copy this snippet:

<script src="http://d3js.org/d3.v3.min.js"></script> 

In our basic examples, we can just open our HTML document in a web browser to view it. But when we need to load external data sources, we need to publish the folder on a web server like Apache, nginx, or IIS. Python provides us with an easy way to run a web server with http.server, so we just need to open the folder where our D3 files are present and execute the following command in the terminal:

$ python3 -m http.server 8000

In Windows, you can use the same command by removing the number 3 from Python:

> python -m http.server ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required