Rendering in Canvas on the server

How about we do another one of those things right now? As mentioned before, the output from our little server app is pretty dull. Let's render a map using Canvas!

For this to work on the server, we're going to need to install node-canvas, which uses Cairo as a dependency. Assuming you're in Mac OS X and have Homebrew installed, run the following:

$ brew install pkg-config cairo libpng jpeg giflib

If you're not an OS X user with Homebrew installed, I suggest visiting and following the instructions there.


Alternatively, you can skip this entirely if you don't care to test locally, as we'll be deploying this all to Heroku later on in the chapter.

Next, add node-canvas to ...

Get D3.js: Cutting-edge Data Visualization now with the O’Reilly learning platform.

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