Skip to content

Commit

Permalink
Merge branch '1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed Sep 16, 2012
2 parents 47d26fc + 10eb079 commit 0a7bf20
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 9 deletions.
23 changes: 21 additions & 2 deletions crossfilter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(function(exports){
crossfilter.version = "1.0.3";
crossfilter.version = "1.1.0";
function crossfilter_identity(d) {
return d;
}
Expand Down Expand Up @@ -557,6 +557,7 @@ function crossfilter() {
filterRange: filterRange,
filterAll: filterAll,
top: top,
bottom: bottom,
group: group,
groupAll: groupAll
};
Expand Down Expand Up @@ -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 = [],
Expand All @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion crossfilter.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "crossfilter",
"version": "1.0.3",
"version": "1.1.0",
"description": "Fast multidimensional filtering for coordinated views.",
"keywords": [
"square",
Expand Down
21 changes: 20 additions & 1 deletion src/crossfilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function crossfilter() {
filterRange: filterRange,
filterAll: filterAll,
top: top,
bottom: bottom,
group: group,
groupAll: groupAll
};
Expand Down Expand Up @@ -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 = [],
Expand All @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion src/version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
crossfilter.version = "1.0.3";
crossfilter.version = "1.1.0";
Loading

0 comments on commit 0a7bf20

Please sign in to comment.