Skip to content

Commit 29e40b0

Browse files
committed
edits
1 parent bd58774 commit 29e40b0

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

src/transforms/group.d.ts

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,40 @@ import type {ChannelReducers} from "../channel.js";
22
import type {Reducer} from "../reducer.js";
33
import type {Transformed} from "./basic.js";
44

5+
/** Options for outputs of the group transform. */
56
export interface GroupOutputOptions {
67
/**
7-
* The data reducer; defaults to the subset of data corresponding to the
8-
* group in input order.
8+
* How to reduce data; defaults to the identity reducer, outputting the array
9+
* of data for each group in input order.
910
*/
1011
data?: Reducer | null;
12+
1113
/**
12-
* The filter reducer, defaults to a check on empty groups. Use null to return
13-
* all groups, for example to impute sum=0 for a line chart.
14+
* How to filter groups: if the reducer emits a falsey value, the group will
15+
* be dropped; by default, empty groups are dropped. Use null to disable
16+
* filtering and return all groups, for example to impute missing zeroes when
17+
* summing values for a line chart.
1418
*/
1519
filter?: Reducer | null;
20+
1621
/**
17-
* The order in which the groups are generated.
22+
* How to order groups. By default, groups are returned in ascending natural
23+
* order along *x*, *y*, and *z* (or *fill* or *stroke*). Group order affects
24+
* draw order of overlapping marks, and may be useful in conjunction with the
25+
* stack transform which defaults to input order. For example to place the
26+
* smallest group within each stack on the baseline:
27+
*
28+
* ```js
29+
* Plot.groupX({y: "count", sort: "count"}, {fill: "sex", x: "sport"})
30+
* ```
1831
*/
1932
sort?: Reducer | null;
20-
/**
21-
* Reverse the order in which the groups are generated.
22-
*/
33+
34+
/** If true, reverse the order of generated groups; defaults to false. */
2335
reverse?: boolean;
2436
}
2537

38+
/** How to reduce grouped channel values. */
2639
export type GroupOutputs = ChannelReducers & GroupOutputOptions;
2740

2841
/**

0 commit comments

Comments
 (0)