void Start() { // import/user settings mode = graphType.barchart; //calls parser googleSheets primer = new googleSheets(); primer.GoogleClientSet(googleID, googleSecret);// sets statics for google aheets parser = new dataPars(dataScorce.googleSheet, link, page - 1, startingPoint); //sets mode switch (mode) { case graphType.barchart: { barChart = new barChartMain(parser.getParsedData(), this.gameObject);; break; } } }
public dataPars(dataGraph.dataScorce scorce, string url, int page, int[] startingPoint) // scorce of data, the sheets url, the page number { //gets the data and puts it in a common var if (scorce == dataGraph.dataScorce.googleSheet) { sheet = new googleSheets(url, page); data = sheet.getOutData(); } if (data == null) { Debug.Log("no data in page"); return; } // finds the number of cats int numOfCats = 0; for (int i = 0; i < data.GetLength(1); i++) { if ((startingPoint[1] + i) < data.GetLength(1) && data[startingPoint[0], (startingPoint[1] + i)] != (object)"") { numOfCats++; } else { break; } } //populates the list of cats cat = new string[numOfCats]; for (int i = 0; i < cat.Length; i++) { cat[i] = (string)data[startingPoint[0], startingPoint[1] + i]; } //find the number of rows int numOfrows = 0; for (int i = 1; i < data.GetLength(0); i++) { if ((startingPoint[0] + i) < data.GetLength(0) && data[startingPoint[0] + i, startingPoint[1]] != (object)"") { numOfrows++; } else { break;; } } //populates the parsData parsedData = new object[numOfrows, numOfCats]; for (int i = 0; i < numOfrows; i++) { for (int j = 0; j < numOfCats; j++) { parsedData[i, j] = data[(startingPoint[0] + 1) + i, startingPoint[1] + j]; } } }