Skip to content
Browse files
  • Loading branch information
mbostock committed Mar 22, 2018
1 parent 3fa7ace commit b7e35164c96b7f9c1bc60911b50d128b067a33e6
Showing 1 changed file with 36 additions and 0 deletions.
@@ -1,3 +1,39 @@
# Changes in D3 5.0

D3 5.0 introduces only a few non-backwards-compatible changes.

D3 now uses [Promises]( instead of asynchronous callbacks. Promises simplify the structure of asynchronous code, especially in modern browsers that support [async and await]( For example, to load a CSV file in v4, you might say:

d3.csv("file.csv", function(error, data) {
if (error) throw error;

In v5, using promises:

d3.csv("file.csv").then(function(data) {

Note that you don’t need to check the error—the promise will reject automatically, and you can *promise*.catch if desired. Using await, the code is even simpler:

const data = await d3.csv("file.csv");

With the adoption of promises, D3 now uses the modern [Fetch API]( instead of [XMLHttpRequest]( the [d3-request]( module has been deprecated add replaced by [d3-fetch]( Fetch supports many powerful new features, such as [streaming responses]( D3 5.0 also deprecates and removes the [d3-queue]( module. You can use [Promise.all]( to run a batch of asynchronous tasks in parallel, or a helper library such as [p-queue]( to control concurrency. See this [interactive introduction to p-queue](

D3 no longer provides the d3.schemeCategory20* categorical color schemes. These twenty-color schemes were flawed because their grouped design could falsely imply relationships in the data: a shared hue can imply that the encoded data are part of a group (a super-category), while relative lightness can imply order. In their stead, D3 now includes [d3-scale-chromatic](, which implements excellent schemes from ColorBrewer, including [categorical](, [diverging](, [sequential single-hue]( and [sequential multi-hue]( color schemes. These schemes are available in both discrete and continuous variants.

D3 now provides implementations of marching squares and density estimation via [d3-contour]( There are two new [d3-selection]( methods: [*selection*.clone]( for inserting clones of the selected nodes, and [d3.create]( for creating detached elements. [Geographic projections]( now support [*projection*.angle](, which has enabled some fantastic new [polyhedral projections](

Lastly, D3’s [package.json]( no longer pins exact version numbers of the dependent D3 modules. This fixes an issue with [duplicate copies]( of D3 modules at different versions.

# Changes in D3 4.0

D3 4.0 is modular. Instead of one library, D3 is now [many small libraries](#table-of-contents) that are designed to work together. You can pick and choose which parts to use as you see fit. Each library is maintained in its own repository, allowing decentralized ownership and independent release cycles. The default bundle combines about thirty of these microlibraries.

1 comment on commit b7e3516

Copy link

@ZJONSSON ZJONSSON commented on b7e3516 Mar 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Please sign in to comment.