# HG changeset patch # User Nicholas Jillings # Date 1456256118 0 # Node ID 04a64127ebd0f40b2090c94c6c7651a2bc18e8ad # Parent 03e713d870cf2a51f45907964e306ba11cc7f582 Analysis: Mean bar plot diff -r 03e713d870cf -r 04a64127ebd0 analysis/analysis.js --- a/analysis/analysis.js Tue Feb 23 18:57:26 2016 +0000 +++ b/analysis/analysis.js Tue Feb 23 19:35:18 2016 +0000 @@ -10,20 +10,71 @@ } function Chart() { - this.data = null; + this.valueData = null; + this.commentData = null; + this.loadStatus = 0; - this.getValueData = function() { - var XMLHttp = new XMLHttpRequest(); - XMLHttp.parent = this; - XMLHttp.open("GET","comment_parser.php?format=JSON",true); - XMLHttp.onload = function() { - // Now we have the JSON data, extract - this.parent.data = JSON.parse(this.responseText); - } - XMLHttp.send(); + var XMLHttp = new XMLHttpRequest(); + XMLHttp.parent = this; + XMLHttp.open("GET","../scripts/score_parser.php?format=JSON",true); + XMLHttp.onload = function() { + // Now we have the JSON data, extract + this.parent.valueData = JSON.parse(this.responseText); + this.parent.loadStatus++; } + XMLHttp.send(); + var XMLHttp2 = new XMLHttpRequest(); + XMLHttp2.parent = this; + XMLHttp2.open("GET","../scripts/comment_parser.php?format=JSON",true); + XMLHttp2.onload = function() { + // Now we have the JSON data, extract + this.parent.commentData = JSON.parse(this.responseText); + this.parent.loadStatus++; + } + XMLHttp2.send(); this.drawMean = function() { // First we must get the value data + if (this.valueData == null) { + console.log("Error - Data not loaded"); + return; + } + // We create one plot per page + for (var page of this.valueData.pages) { + // First, create the chart resulting point + var inject = document.createElement("div"); + document.getElementById("test-pages").appendChild(inject); + + // Create the data table + var data = new google.visualization.DataTable(); + data.addColumn('string','id'); + // Get axis labels + for (var axis of page.elements[0].axis) { + data.addColumn('number',axis.name); + } + var rows = []; // Rows is an array of tuples [col1, col2, col3 ... colN]; + for (var element of page.elements) { + var entry = [element.id]; + for (var i=0; i

Web Audio Evaluation Toolbox: Analysis

+
-
\ No newline at end of file