This chart shows yearly coffee sales data from 3 worksheets from my Google Spreadsheet.
The page will fire up from body onload() event. This event calls the function getGoogleSpreadsheetData() and pass the Google Spreadsheet key "p06JfhjnK8PwEWRkmlWiiQg" (my spreadsheet unique key) as parameter. The function fetches all worksheets from from the spreadsheet and then fetches individual data from each worksheet.To simplify the demosntration I am taking the the values from the first column as category labels of the chart. Since, Google Data List API does not yet pass the title name of the first column, I am hadrcoding it in the code as "Products". I take the values from the second column from each worksheet and combine each set of values to show Sales Comparison in the chart.
NOTE: I have used Goessner’s excellent jsonT library to parse JSON. I have modified some part of jsonT to accomodate json properties having $ in key names. I replaced the standard jsonT shortcut $ with # to cope with this issue where the property names in JSON data contains $.