Mercurial > hg > webaudioevaluationtool
comparison analysis/analysis.js @ 1265:5946b03fffe5
Analysis.js sort uses Google's DataTable sort functions.
author | Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk> |
---|---|
date | Mon, 21 Mar 2016 16:22:49 +0000 |
parents | 055d020099ea |
children | 227ca4d00ab1 |
comparison
equal
deleted
inserted
replaced
1264:055d020099ea | 1265:5946b03fffe5 |
---|---|
130 this.buildTable(); | 130 this.buildTable(); |
131 this.writeLatex(); | 131 this.writeLatex(); |
132 this.chart.draw(this.data,this.options); | 132 this.chart.draw(this.data,this.options); |
133 } | 133 } |
134 this.sortData = function() { | 134 this.sortData = function() { |
135 | 135 this.data.sort(1); |
136 var map = this.data.Jf.map(function(el,i){ | |
137 return {index: i, value: el.c[1].v}; | |
138 }); | |
139 | |
140 map.sort(function(a,b){ | |
141 if (a.value > b.value) {return -1;} | |
142 if (a.value < b.value) {return 1;} | |
143 return 0; | |
144 }) | |
145 | |
146 var Jf = []; | |
147 var cc = []; | |
148 for (var i=0; i<map.length; i++) { | |
149 Jf.push(this.data.Jf[map[i].index]); | |
150 cc.push(this.data.cc[map[i].index]); | |
151 } | |
152 this.data.Jf = Jf; | |
153 this.data.cc = cc; | |
154 } | 136 } |
155 this.sortName = function() { | 137 this.sortName = function() { |
156 var map = this.data.Jf.map(function(el,i){ | 138 this.data.sort(0); |
157 return {index: i, value: el.c[0].v}; | |
158 }); | |
159 | |
160 map.sort(function(a,b){ | |
161 if (a.value < b.value) {return -1;} | |
162 if (a.value > b.value) {return 1;} | |
163 return 0; | |
164 }) | |
165 | |
166 var Jf = []; | |
167 var cc = []; | |
168 for (var i=0; i<map.length; i++) { | |
169 Jf.push(this.data.Jf[map[i].index]); | |
170 cc.push(this.data.cc[map[i].index]); | |
171 } | |
172 this.data.Jf = Jf; | |
173 this.data.cc = cc; | |
174 } | 139 } |
175 this.handleEvent = function() { | 140 this.handleEvent = function() { |
176 // Only used to handle the chart.event.addListener(this,'ready') callback | 141 // Only used to handle the chart.event.addListener(this,'ready') callback |
177 switch(event.currentTarget.getAttribute("name")) | 142 switch(event.currentTarget.getAttribute("name")) |
178 { | 143 { |