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 ...
Get Data Visualization: Representing Information on Modern Web now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.