Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Responsive Data Visualization

You're reading from   Learning Responsive Data Visualization Create stunning data visualizations that look awesome on every device and screen resolutions

Arrow left icon
Product type Paperback
Published in Mar 2016
Publisher
ISBN-13 9781785883781
Length 258 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Christoph Körner Christoph Körner
Author Profile Icon Christoph Körner
Christoph Körner
Erik Hanchett Erik Hanchett
Author Profile Icon Erik Hanchett
Erik Hanchett
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Getting Started with Responsive Design, Bootstrap, and D3.js FREE CHAPTER 2. Creating a Bar Chart Using D3.js and SVG 3. Loading, Filtering, and Grouping Data 4. Making the Chart Responsive Using Bootstrap and Media Queries 5. Building Responsive Interactions 6. Designing Transitions and Animations 7. Creating Maps and Cartographic Visualizations Using GeoJSON 8. Testing Responsive Visualizations 9. Solving Cross-Browser Issues Index

Creating graphics with D3.js

D3.js (abbreviation for Data-Driven Documents) is a JavaScript library built by Mike Bostock and other members of the Stanford Visualization Group for DOM manipulation, data transformation, and graphic creation. It uses a jQuery-like, data-driven approach and leverages all the capabilities of modern browsers and underlying web standards (such as HTML, CSS, and SVG).

D3.js is open source and hosted on GitHub (https://github.com/mbostock/d3) under a slightly modified BSD 3-clause license; therefore, it can be used in open source and commercial products without being required to release any modifications. GitHub itself uses D3.js to visualize the contribution history of repositories.

Throughout this book, we will use the stable version 3.5.6, but most examples should also work with different minor versions.

Including D3.js

There are multiple ways to include D3.js to your project:

  • Using the package manager called bower (recommended), fetch the library by running the bower install d3#3.5.6 command from the terminal. Then, link the minified CSS file from the bower_components/ directory in the head section of the web page: <link rel="stylesheet" href="bower_components/d3/d3.min.css">.
  • Using a CDN, such as cdnjs (this requires an active Internet connection while developing), include the minified CSS file from the CDN in the head section of the web page: <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js">.
  • Manually download the 3.5.6 release from GitHub (https://github.com/mbostock/d3/releases) and unzip it into the libs/ directory. Then, link the minified CSS file from the libs/ directory in the head section of the web page <link rel="stylesheet" href="libs/d3/d3.min.css">.

I strongly recommend using the package manager called bower to manage your frontend dependencies. However, in the examples of the book, we will link D3.js directly from cdnjs for simplicity reasons; therefore, all the examples in the source of the book require an active Internet connection.

Finding additional resources

The ultimate resource for D3.js is the WIKI page of the GitHub project, which can be found at https://github.com/mbostock/d3/wiki. Here, you will also find examples and a detailed description of the API.

Another great resource for examples is Mike Bostock's page at http://bl.ocks.org/mbostock and his blog at http://bost.ocks.org/mike/.

For more detailed information and examples, I recommend reading the Mastering D3.js book by Pablo Navarro Castillo.

You have been reading a chapter from
Learning Responsive Data Visualization
Published in: Mar 2016
Publisher:
ISBN-13: 9781785883781
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image