Review of "Data Visualization with D3.js Cookbook" by Nick Qi Zhu

Great book, solid advice, focused on D3-specifics.

"Data Visualization with D3.js Cookbook" by Nick Qi Zhu, ISBN 978-1-78216-216-2

The book starts with a very helpful intro to the functional-style JavaScript programming practiced by D3. Everything is a function that usually returns an instance, allowing to chain method calls

1
2
3
4
5
6
7
8
9
function Something() {
var instance = {};
instance.name = function (n) { instance.name = n; return instance; };
instance.color = function (c) { instance.color = c; return instance; };
return instance;
}
var s = Something()
.name('Mr.S')
.color('gray');

This is neither classical object oriented, nor prototypical JavaScript programming. Most books and tutorials on D3 skip this explanation. In this case, the author makes the right call and shows that he understands what will puzzle the majority of people using D3 library.

The book moves on to cover major D3 topics: selections, data binding, element attributes, axes, etc. Each chapter provides plenty of source code listings, with lines relevant to the topic at hand highlighted. The book strikes perfect balance between explaining each concept clearly, but without boring the reader with needless repetition.

I wish the author provided examples as jsFiddle snippets in addition to github pages to make executing them faster. I do appreciate that every example (that does not load any data) loads as a static page, if you grab the entire book example repo from github.