Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/transforms/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
} from "d3";
import {ascendingDefined} from "../defined.js";
import {
arrayify,
column,
identity,
isObject,
Expand Down Expand Up @@ -444,6 +445,7 @@ export function find(test) {
if (typeof test !== "function") throw new Error(`invalid test function: ${test}`);
return {
reduceIndex(I, V, {data}) {
data = arrayify(data);
return V[I.find((i) => test(data[i], i, data))];
}
};
Expand Down
7 changes: 5 additions & 2 deletions src/transforms/stack.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {InternMap, cumsum, greatest, group, groupSort, max, min, rollup, sum} fr
import {ascendingDefined, descendingDefined} from "../defined.js";
import {withTip} from "../mark.js";
import {maybeApplyInterval, maybeColumn, maybeZ, maybeZero} from "../options.js";
import {column, field, lengthof, mid, one, range, valueof} from "../options.js";
import {arrayify, column, field, lengthof, mid, one, range, valueof} from "../options.js";
import {basic} from "./basic.js";
import {exclusiveFacets} from "./exclusiveFacets.js";

Expand Down Expand Up @@ -327,7 +327,10 @@ function orderAccessor(f) {
}

function orderComparator(f) {
return (data) => (i, j) => f(data[i], data[j]);
return (data) => {
data = arrayify(data);
return (i, j) => f(data[i], data[j]);
};
}

function orderGiven(domain) {
Expand Down