BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News D3 JavaScript Visualization Library Hits 4.0

D3 JavaScript Visualization Library Hits 4.0

Version 4.0 of D3.js, the JavaScript visualization library, has been released. While some JavaScript libraries don't change much when the major version bumps, D3.js 4.0 represents a significant rewrite and major upgrade.

Mike Bostock, creator of D3, has been working on version 4 full-time over the past year and says D3 is "more popular than I could have imagined, and I want to make sure that it’s as good as I can make it." Previously, Bostock worked at the New York Times where he used D3 to help craft news stories with rich data visualization, such as "The Most Detailed Maps You’ll See From the Midterm Elections".

The biggest change is that the library has been broken down into smaller modules. While developers can still choose to download the entire library, separate npm installs are available for components such as d3-interpolate and d3-axis. Bostock says the new modular design should make collaboration easier:

Part of the goal of 4.0’s modularity is to make it easier for others to release their new features as standalone libraries that they can use with D3, rather than it needing to be part of “core”. There isn’t a "core" D3 anymore; there’s just a default bundle.

There are a vast number of new features and bug fixes. For example, there are new ways to create color schemes such as ones based on the ColorBrewer schemes. The new d3-scale-chromatic can provide colors from discrete sets as well as colors along a continuous range.

The function d3.interpolateRdBu(t), given a value for t between 0 and 1, will return an RGB hexadecimal string somewhere in this range:

red to blue color gradient

Now that v4 has shipped, Bostock is focusing on updating all of the examples and tutorials. The full release notes are extremely thorough and pleasant to read.

D3 has a reputation for being complicated; difficult to get started with and comprehend. Other charting libraries such as C3 abstract away a lot of D3's complexity to cover the common use cases for many developers. However, D3's offers tremendous power to those that need to build custom visualizations based on data.

Rate this Article

Adoption
Style

BT