When I wrote the first edition of D3.js in Action, I did it mostly as a way to learn the library. I knew D3 well enough to do cool things with it, but like many people, I didn’t know the breadth and depth of it, nor did I really understand the structure of layouts and generators and its other aspects. I agreed to write the book as a sort of graduate school in D3, to become an expert in the library, and to become better at data visualization more generally. I came at the second edition from a different perspective. I knew D3 as well as most anyone could, and the changes from V3 to V4, while significant, were straightforward enough to explain. But in the last two and a half years, I’ve been a professional software developer, and I better understand where D3 sits in an ecosystem of applications and libraries. This time I didn’t set out to write a book to learn D3; this time I set out to write a book to teach people how to use D3, not only on its own but in reference to other libraries and to JavaScript.
One of the things I want to teach now is how to create impactful data visualization using D3 rather than pushing your limits on how to generate the most complex charts. That doesn’t mean I don’t get into the ambitious data visualization methods that D3 allows—I still explore how to create network data visualization and geospatial maps with D3—but it does mean the code and the text better reflect the needs of people who want to learn how to make effective data visualization more than they want to learn how to use D3.
That’s why the second edition has sections on D3.js in the real world written by experts who’ve used D3 for analysis, storytelling, and journalism. That’s also why I pulled out the extraneous bits from the first edition that showed you how to use D3 like JQuery, and replaced those with more in-depth analysis of how to create hierarchical data visualization and how to integrate D3 with popular frameworks.
The code is much cleaner in the second edition, which is as much a result of my own experience as it is a result of the advances in JavaScript in the last couple years. Because I’ve grown more professional in my practice doesn’t mean I’ve grown less ambitious in how I use D3 and how I think people should use D3. This is still a long book, and it has to be because it’s an exhaustive look at the ins and outs of an important library in an exciting and fast-growing field.