O'Reilly logo

Expert Data Visualization by Jos Dirksen

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

Adding images to the circles for the characters

Before we can look at the JavaScript needed to add the images to the visualization, we first need to get the images. We could use Google and get the images manually, but that's too much work. So, we've written a script that pulls down the images from WikiSimpsons (https://simpsonswiki.com). WikiSimpsons has a detail page for each episode, in which they list appearances and show a nice image of that character.

The script (which can be found in DVD3/src/chapter-04/data/downloadAppearances.js) looks like this:

var https = require('https'); var cheerio = require('cheerio'); var idl = require('image-downloader');  var mapping = {     "waylon smithers, jr.": "waylon smithers",  "charles montgomery burns" ...

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