Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ui stage2 #74

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
832 changes: 779 additions & 53 deletions dist/PublicLab.Grapher.js

Large diffs are not rendered by default.

51 changes: 50 additions & 1 deletion dist/transpiled_code/CsvParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,18 @@ function () {

_defineProperty(this, "elementId", null);

_defineProperty(this, "codapHeaders", []);

_defineProperty(this, "codapMatrix", []);

this.elementId = elementId;
this.csvFile = file;
this.allFunctionHandler(functionParameter);

if (functionParameter == "prevfile") {
return this;
} else {
this.allFunctionHandler(functionParameter);
}
} //since parsing a local file works asynchronously, a callback function is required to call the remaining functions after the parsing is complete


Expand All @@ -58,6 +67,8 @@ function () {
this.csvSampleData = totalData[0];
this.csvValidForYAxis = totalData[1];
this.completeCsvMatrixTranspose = this.createTranspose();
this.codapHeaders = this.headersForCodap();
this.codapMatrix = this.completeMatrixForCodap();
this.startFileProcessing();
} //a function handler that calls one function after the other after assigning the correct values to different class variables.

Expand All @@ -81,6 +92,8 @@ function () {
this.csvSampleData = totalData[0];
this.csvValidForYAxis = totalData[1];
this.completeCsvMatrixTranspose = this.createTranspose();
this.codapHeaders = this.headersForCodap();
this.codapMatrix = this.completeMatrixForCodap();
this.startFileProcessing();
}
} //parsing a local file, works asynchronously
Expand All @@ -102,6 +115,8 @@ function () {
count += 1;
},
complete: function complete() {
console.log("is it?", csvMatrixLocal);

_this.callbackForLocalFile(csvMatrixLocal);
}
});
Expand Down Expand Up @@ -223,6 +238,25 @@ function () {
}

return matrixComplete;
} // matrix in JSON form for CODAP export

}, {
key: "completeMatrixForCodap",
value: function completeMatrixForCodap() {
var codapMatrix = [];

for (var i = 1; i < this.completeCsvMatrixTranspose.length; i++) {
var element = {};

for (var j = 0; j < this.csvHeaders.length; j++) {
element[this.csvHeaders[j]] = this.completeCsvMatrixTranspose[i][j];
}

codapMatrix.push(element);
}

console.log("matrix codap", codapMatrix);
return codapMatrix;
} //checks if the first row has most of the potential header names, if not, assign dummy headers to the file.

}, {
Expand Down Expand Up @@ -282,6 +316,20 @@ function () {
}

return headers_sheet;
} //determine a JSON for headers for CODAP

}, {
key: "headersForCodap",
value: function headersForCodap() {
var codapHeaders = [];

for (var i = 0; i < this.csvHeaders.length; i++) {
var element = {};
element["name"] = this.csvHeaders[i];
codapHeaders.push(element);
}

return codapHeaders;
} // creating the transpose of the entire data ie complete data + headers, for createSpreadsheet in View.js

}, {
Expand All @@ -303,6 +351,7 @@ function () {
}
}

console.log("transpose", completeCsvMatrixTransposeLocal);
return completeCsvMatrixTransposeLocal;
}
}]);
Expand Down
Loading