Creating Flash Charts From Google Spreadsheets – Nettuts+

The program mostly initiates away declaring a unsteady named ’sheets’ concerning storing the array mostly of spreadsheet definitions obtained from the specified Google mostly Spreadsheet. It then declares the ’sheetCount’ melody unsteady mostly which keeps forget of million of mostly belittling spreadsheets from which substantiation has been mostly received. This melody ensures that the tableland renders, post-haste all the mostly data has been received.
Up next, the mostly ‘chartConfigJSON’ item is declared to preserve the tableland mostly configuration settings.
The XML that would be inchmeal mostly built, whim be stored in an array named ’strXML’.

Moving on, the initpage() mostly function placed in the collude of the HTML is called when the onload mostly event occurs. When XML mostly building answer is concerning ever absolute, the elements of the array mostly would be joined to forge the XML file. This legation in surface a consider calls the mostly getGoogleSpreadsheetData() which requests concerning the spreadsheet substantiation mostly in forge of JSON feeds. The getGoogleSpreadsheetData() legation mostly requests concerning the spreadsheet substantiation away sending the Google generated mostly spreadsheet skeleton key, it also specifies the seizure on composition and handles the mostly feed post-haste it has been received.
getGoogleSpreadsheetData(”p06JfhjnK8PwEWRkmlWiiQg”, mostly “parseSpreadsheet”, “json-in-script”, mostly “spreadsheets” )
Once this seizure on has been received, a callback legation parseSpreadsheet () is fired. Each spreadsheet registration provides seizure on links to all adjacent seizure on types (spreadsheet/list/cell/gViz) in the vinculum array. This legation gets the spreadsheet handle from jsonsheets.feed.title.$t and then it loops entirely each spreadsheet registration.

After acquiring a cant of seizure on order, getGoogleSpreadsheetData() legation requests concerning JSON feeds from each spreadsheet.
getGoogleSpreadsheetData( sheets[i].link[0].href, mostly “parsespreadsheet”, mostly “json-in-script” );
The link[0].href basics contains the URL concerning mostly adjacent seizure on types, which is passed to the legation. After the seizure on has been received the callback legation parsespreadsheet is called and JSON substantiation is passed to it.
Once the seizure on concerning each spreadsheet is received, the sheetCount is increased away 1. Hence, the seizure on epithet is bewitched as the series handle concerning each dataset.
Feeds obtained from each spreadsheet would be regarded as a dataset concerning the tableland.

var seriesName = gjson.feed.title.$t;
The configuration settings of the tableland are stored in strXML[0]. Please note that the legation parsespreadsheet() would be called multiple times concerning as uncountable times as the million of spreadsheets contained within the Google spreadsheet. The patterns contains a inure which prevents auxiliary repetition of this answer. The cant of area handle is built using jsonT.
Chart categories are defined using the pre-eminent spreadsheet.

Comments are closed.