Permalink
Browse files

Merge branch '1.1.0'

  • Loading branch information...
2 parents 47d26fc + 10eb079 commit 0a7bf20e08bc889e0ca70a3be7b5d64f45fbe596 @mbostock mbostock committed Sep 16, 2012
Showing with 136 additions and 9 deletions.
  1. +21 −2 crossfilter.js
  2. +1 −1 crossfilter.min.js
  3. +1 −1 package.json
  4. +20 −1 src/crossfilter.js
  5. +1 −1 src/version.js
  6. +92 −3 test/crossfilter-test.js
View
@@ -1,5 +1,5 @@
(function(exports){
-crossfilter.version = "1.0.3";
+crossfilter.version = "1.1.0";
function crossfilter_identity(d) {
return d;
}
@@ -557,6 +557,7 @@ function crossfilter() {
filterRange: filterRange,
filterAll: filterAll,
top: top,
+ bottom: bottom,
group: group,
groupAll: groupAll
};
@@ -721,7 +722,7 @@ function crossfilter() {
return filterIndex((refilter = crossfilter_filterAll)(values));
}
- // Returns the top K selected records, based on this dimension's order.
+ // Returns the top K selected records based on this dimension's order.
// Note: observes this dimension's filter, unlike group and groupAll.
function top(k) {
var array = [],
@@ -738,6 +739,24 @@ function crossfilter() {
return array;
}
+ // Returns the bottom K selected records based on this dimension's order.
+ // Note: observes this dimension's filter, unlike group and groupAll.
+ function bottom(k) {
+ var array = [],
+ i = lo0,
+ j;
+
+ while (i < hi0 && k > 0) {
+ if (!filters[j = index[i]]) {
+ array.push(data[j]);
+ --k;
+ }
+ i++;
+ }
+
+ return array;
+ }
+
// Adds a new group to this dimension, using the specified key function.
function group(key) {
var group = {
View
Oops, something went wrong.
View
@@ -1,6 +1,6 @@
{
"name": "crossfilter",
- "version": "1.0.3",
+ "version": "1.1.0",
"description": "Fast multidimensional filtering for coordinated views.",
"keywords": [
"square",
View
@@ -42,6 +42,7 @@ function crossfilter() {
filterRange: filterRange,
filterAll: filterAll,
top: top,
+ bottom: bottom,
group: group,
groupAll: groupAll
};
@@ -206,7 +207,7 @@ function crossfilter() {
return filterIndex((refilter = crossfilter_filterAll)(values));
}
- // Returns the top K selected records, based on this dimension's order.
+ // Returns the top K selected records based on this dimension's order.
// Note: observes this dimension's filter, unlike group and groupAll.
function top(k) {
var array = [],
@@ -223,6 +224,24 @@ function crossfilter() {
return array;
}
+ // Returns the bottom K selected records based on this dimension's order.
+ // Note: observes this dimension's filter, unlike group and groupAll.
+ function bottom(k) {
+ var array = [],
+ i = lo0,
+ j;
+
+ while (i < hi0 && k > 0) {
+ if (!filters[j = index[i]]) {
+ array.push(data[j]);
+ --k;
+ }
+ i++;
+ }
+
+ return array;
+ }
+
// Adds a new group to this dimension, using the specified key function.
function group(key) {
var group = {
View
@@ -1 +1 @@
-crossfilter.version = "1.0.3";
+crossfilter.version = "1.1.0";
Oops, something went wrong.

0 comments on commit 0a7bf20

Please sign in to comment.