Creating an HTML template for D3.js
To set up a template page for all visualization examples, we first need to download D3.js and include it to the application. In this book, we will use version 3.5.5, but all of the examples should also work with slightly different versions (~3.4.12 and ~3.5.0). There are multiple ways to add D3.js to an application:
- Installing it with the package manager bower (recommended):
bower install d3#3.5.5
- Loading it from a Content Delivery Network (CDN) (//cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.js).
- Downloading it and storing it to a
libs
directory (https://github.com/mbostock/d3/releases/tag/v3.5.5).
The easiest way to use D3.js in our application is to simply download D3.js directly from GitHub and extract it into the libs
directory. In contrast to the CDN method, this does not require an active Internet connection while developing. However, the recommended way is to use a package manager such as bower
to manage and configure all third-party dependencies.
So...