Consolidated check to see if there is enough data for graphing.  Uses the Object.keys() method.  This is unavailable in ie8, but we have added it in useing an es5shim for ie.  See commit 9ebef1b778a7debd6520ee3096b712e1f8de9beb
Merged the two charting functions together and moved charting to its own function.  Also, removed some unused functions, made more explicit variable names and modified formatting slightly.
Minor formatting