This is a pretty darn simple snippet that I learned from a site (don't remember the name). This is just the working Javascript which i managed to "easily" replicate :P
Hopefully this will be useful for you guys.
Note, this won't graph anything unless you have the html/css (i didn't provide that).