Chapter 6. Animating Data Visualizations

Data visualizations are an extremely useful way to present different kinds of information. Luckily, due to the relative popularity of some libraries, such as D3 and Chartist, small pieces of animation are easy to create. These are not the only libraries that can create data visualizations, but there are so many to choose from that I picked my favorites of the many that I’ve worked with.

In this chapter, we’ll implement data visualizations with both D3 and Chartist. Chartist, at the time of publishing, uses the now-deprecated SMIL to animate, so I don’t recommend that you use its native animation functions. D3 also offers some native animations, but you may find that now that you’ve learned some CSS implementations, it’s simpler and certainly more performant to draw the data visualization on the screen and then animate it.

Chartist Versus D3 for Configuration

It’s very simple to create responsive charts and graphs in Chartist, making it very beginner-friendly. The library creates a wrapper for the SVG, so some JavaScript functionality becomes a little obfuscated and less straightforward. For this reason, I strongly suggest using Chartist to draw up simple graphs with simple CSS animations.

D3, on the other hand, is not quite as beginner-friendly, but very easy to work with and extend. The sky is the limit on what you can create in D3, which has made it the library of choice for many beautiful data visualizations across the web.

Simply ...

Get SVG Animations now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.