O'Reilly logo

Social Data Visualization with HTML5 and JavaScript by Simon Timms

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

Visualization

There is a whole bunch of APIs made available to us by Twitter. We should start perhaps by inventing something we would like to visualize and then decide if the data is available and how we would show it. I'm curious about which of the people I follow tweet the most. Some accounts such as @kellabyte seem to always be tweeting and others like @ericevans hardly at all.

Server side

Let's start by getting the data on the server side. In node.js, I set up a new route using the following code:

app.get('/friends', function(req, res){ if(!req.session.oAuthVars || !req.session.oAuthVars.oauth_access_token){ res.redirect('/requestOAuth'); return; } var cursor = -1; receiveUserListPage(res, req.session.twitterVars.user_id, req.session.oAuthVars.oauth_access_token, ...

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