O'Reilly logo

Learning d3.js Data Visualization - Second Edition by Swizec Teller, Ændrew Rininsland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 https://github.com/Automattic/node-canvas and following the instructions there.

Tip

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required