New RGraph.each() API function


« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by RGraph support on 26th August 2013
Hi there,

The next beta version will have an "each()" function - much like the jQuery $.each() function - which is useful for iterating over arrays. You use it like this:

var myArray = ['a','b','c','d','e'];

RGraph.each(myArray, function (key, value)
{
     // Remember: The this variable refers to the array

     alert(key + ': ' + value);
    
     // If this function returns false then the iteration over the array will cease
});

The callback function gets called for each element of the array and is passed the key and value of the current element as arguments. Inside the callback function the "this" variable refers to the array. And if the callback returns a boolean false the iteration will cease.




Richard, RGraph Support

Add a reply

 




« Back to message list
RGraph on social media