Since a Graph List's data
property is an array of Graph Objects, we could just loop through the array and create a new Graph Object Renderer for each element. Feel free to have a go at this, if you like, but I've got another solution.
I've created a second renderer: this time, a Graph List Renderer. I've also created a class graph.GraphList
. And
CustomGraphContainerController
inherits a method called renderGraphList()
. Perhaps unsurprisingly, this takes an object of type graph.GraphList
as a parameter, and creates a new Graph List Renderer to display its contents. So, we need to take a Graph List that we receive from the Graph API, and turn it into an instance of the GraphList
class. The GraphList
class is a little more sophisticated than the
GraphObject
class; it has a method called addToList()
, to which we can pass any GraphObject
instance to be added to the list.
We'll still loop through the data
array, then, but instead of rendering each GraphObject...