Retrieving data

Before we go about retrieving data we should probably decide what data we wish to visualize. The amount of data which is available about the logged in user is not all that great (at least it isn't for me but I hardly use Facebook). That leaves us with looking at our friends. I found devices my friends use to access Facebook to be quite interesting. Are they more Android users or iOS? This information is available as part of the friends' collection. To retrieve this information we can use the FB.api() method:

FB.api('/me?fields=friends.fields(devices)', function(response){ for(i = 0; len = response.friends.data.length; i< len; i++){ var friend = response.friends.data[i]; if(friend.devices) for(j = 0; j< friend.devices.length; j++) ...

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.