Review: Data Visualization with D3.js Cookbook

I’ve been looking around for decent data visualization book on D3.  I think I’ve found it.

Data Visualization with D3.js Cookbook by Packt Publishing hits the mark.

It’s the right blend of detailed explanation combined with cookbook recipes to get going.

D3 is JavaScript library that separates data from presentation, but does so in a really cool manner.  When the underlying data is updated, the components on the screen that visualize it can be made to update to reflect it. This can lead to some pretty amazing transitions and interactivity with surprisingly little code.

D3 looks at the data you have visualized already and the data you want to visualize and divides them into three piles: New Data, Updated Data, and No Longer Present Data.  Transformations can be done for each set, for instance allowing new data to fade in, updated data to morph, and removed data to fade away.  D3 is focused primarily on just this task, so actual visualizations are up to the coder.

However, because D3’s nature allows each element to only focus on the part of the data it needs to, and to substitute that content into the HTML, CSS, and/or SVG that’s needed, it provides a surprising amount of flexibility and features and does so with impressive speed and efficiency.

The Data Visualization with D3.js Cookbook explains the above concepts with some well formed examples, and then proceeds to demonstrate how to make bar charts, pie charts, line charts, and other more complex multi-dimensional visualizations and add interactive interfaces to them. This is where the book absolutely shines!

Each example is carefully constructed and compact, serving both as a learning tool and a starting point for your own code.  As such, I’d highly recommend the book and convey that it’s very approachable, even to those with a limited JavaScript background.

I would recommend some degree of caution however, in particular with the Kindle book. This is not a fault of Packt Publishing, but with Amazon.  And I’ve spoken to them at length about it.  The Kindle viewer is intended of rendering pages of readable text to humans in a nicely formatted manner.  However, it is terrible (as of the time of this writing) as to maintaining code formatting and spacing, which is absolutely essential for any cut’n’paste operations. Be prepared to copy code by hand, and if you’re going to go that far, perhaps the paperback version is more to your liking.

That said, I did happen to notice a few errata in the examples; nothing major, nothing you can’t move past, and nothing that isn’t rectified by going onto GitHub for the updates.

All in all, after having gone through a number of books about D3.js, this one has been my favorite and the most useful.