@@ -118,12 +118,12 @@ export interface Channel {
118118/**
119119 * A channel’s values may be expressed as:
120120 *
121- * * a function that returns the corresponding value for each datum
122- * * a field name, to extract the corresponding value for each datum
123- * * an iterable of values, typically of the same length as the data
124- * * a channel transform that returns an iterable of values given the data
125- * * a constant date, number, or boolean
126- * * null to represent no value
121+ * - a function that returns the corresponding value for each datum
122+ * - a field name, to extract the corresponding value for each datum
123+ * - an iterable of values, typically of the same length as the data
124+ * - a channel transform that returns an iterable of values given the data
125+ * - a constant date, number, or boolean
126+ * - null to represent no value
127127 */
128128export type ChannelValue =
129129 | Iterable < any > // column of values
@@ -152,42 +152,26 @@ export type ChannelValueIntervalSpec = ChannelValueSpec | {value: ChannelValue;
152152 * The available inputs for imputing scale domains. In addition to a named
153153 * channel, an input may be specified as:
154154 *
155- * * *data* - impute from mark data
156- * * *width* - impute from |*x2* - *x1*|
157- * * *height* - impute from |*y2* - *y1*|
158- * * null - impute from input order
155+ * - *data* - impute from mark data
156+ * - *width* - impute from |*x2* - *x1*|
157+ * - *height* - impute from |*y2* - *y1*|
158+ * - null - impute from input order
159159 */
160160export type ChannelDomainValue = ChannelName | "data" | "width" | "height" | null ;
161161
162162/** Options for imputing scale domains from channel values. */
163163export interface ChannelDomainOptions {
164164 /**
165165 * How to produce a singular value (for subsequent sorting) from aggregated
166- * channel values. Defaults to *max*. A reducer may be specified as :
166+ * channel values; one of :
167167 *
168- * * *first* - the first value, in input order
169- * * *last* - the last value, in input order
170- * * *count* - the number of elements (frequency)
171- * * *distinct* - the number of distinct values
172- * * *sum* - the sum of values
173- * * *min* - the minimum value
174- * * *min-index* - the zero-based index of the minimum value
175- * * *max* - the maximum value
176- * * *max-index* - the zero-based index of the maximum value
177- * * *mean* - the mean value (average)
178- * * *median* - the median value
179- * * *mode* - the value with the most occurrences
180- * * *pXX* - the percentile value, where XX is a number in [00,99]
181- * * *deviation* - the standard deviation
182- * * *variance* - the variance per [Welford’s algorithm](https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford's_online_algorithm)
183- * * a function to be passed the array of values
184- * * an object with a *reduce* method
185- *
186- * In the last case, the *reduce* method is repeatedly passed an index (an
187- * array of integers) and the channel’s array of values; it must then return
188- * the corresponding aggregate value for the bin.
168+ * - true (default) - alias for *max*
169+ * - false or null - disabled; don’t impute the scale domain
170+ * - a named reducer implementation such as *count* or *sum*
171+ * - a function that takes an array of values and returns the reduced value
172+ * - an object that implements the *reduceIndex* method
189173 */
190- reduce ?: Reducer | true ;
174+ reduce ?: Reducer | boolean | null ;
191175
192176 /** If true, use descending instead of ascending order. */
193177 reverse ?: boolean ;
@@ -209,7 +193,20 @@ export type ChannelDomainValueSpec = ChannelDomainValue | ({value: ChannelDomain
209193/** How to impute scale domains from channel values. */
210194export type ChannelDomainSort = { [ key in ScaleName ] ?: ChannelDomainValueSpec } & ChannelDomainOptions ;
211195
212- /** How to reduce channel values, e.g. when binning or grouping. */
196+ /**
197+ * Output channels for aggregating transforms, such as bin and group. Each
198+ * declared output channel has an associated reducer, and typically a
199+ * corresponding input channel in *options*. Non-grouping channels declared in
200+ * *options* but not *outputs* are computed on reduced data after grouping,
201+ * which defaults to the array of data for the current group.
202+ *
203+ * If **title** is in *options* but not *outputs*, the reducer defaults to
204+ * summarizing the most common values. If **href** is in *options* but not
205+ * *outputs*, the reducer defaults to *first*. When **x1** or **x2** is in
206+ * *outputs*, reads the input channel **x** if **x1** or **x2** is not in
207+ * *options*; likewise for **y1** or **y2**, reads the input channel **y** if
208+ * **y1** or **y2** is not in *options*.
209+ */
213210export type ChannelReducers < T = Reducer > = { [ key in ChannelName ] ?: T | { reduce : T ; scale ?: Channel [ "scale" ] } | null } ;
214211
215212/** Abstract (unscaled) values, and associated scale, per channel. */
0 commit comments