Skip to content

Commit

Permalink
fix binfacets
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed Jan 3, 2021
1 parent 2718d16 commit 42f3c5a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/transforms/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ function binof({value, domain, thresholds}) {
function binfacets(bins, facets, cumulative) {
const index = [];
const data = [];
let k = 0;
for (const facet of facets.map(set)) {
let b = bins.map(bin => binsubset(bin, facet));
b = cumulative ? accumulate(cumulative < 0 ? b.reverse() : b) : b;
b = b.filter(nonempty);
index.push(offsetRange(b, data.length));
index.push(offsetRange(b, k));
data.push(b);
k += b.length;
}
return {index, data: data.flat()};
}
Expand Down

0 comments on commit 42f3c5a

Please sign in to comment.