Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed the averaging to sort beats again.

  • Loading branch information...
commit 13292e6b6a6fa62d03bdfaf2e936e2f3826e7fc0 1 parent 831737d
@lgarron authored
Showing with 6 additions and 4 deletions.
  1. +6 −4 index.htm
View
10 index.htm
@@ -49,9 +49,11 @@
}
// avg(list, 0.4, 0.6) takes a mean of the middle 20%.
-function avg(list, start, end) {
+function avg(listIn, start, end) {
+ var listCopy = listIn.slice(0);
+ listCopy.sort(function(a, b){return a - b});
var total = 0;
- var l2 = list.slice(Math.floor(start*list.length), Math.ceil(end*list.length));
+ var l2 = listCopy.slice(Math.floor(start*listCopy.length), Math.ceil(end*listCopy.length));
for (var i = 0; i < l2.length; i++) {
total += l2[i];
}
@@ -99,8 +101,8 @@
r.clear();
var m1 = lengths.map(Math.round);
var m2 = m1.map(function(a){return a;});
- m2.reverse();
- r.barchart(0, 0, 640, 120, [m1, m2]).hover(fin, fout);
+ //m2.reverse();
+ r.barchart(0, 0, 640, 120, [m1]).hover(fin, fout);
return true;
Please sign in to comment.
Something went wrong with that request. Please try again.