Given a value in the input domain, returns the corresponding value in the output range.
A numeric value in the input domain.
Returns an exact copy of this scale. Changes to this scale will not affect the returned scale, and vice versa.
Returns the scale’s current domain.
Sets the domain of the quantile scale to the specified set of discrete numeric values. The array must not be empty, and must contain at least one numeric value; NaN, null and undefined values are ignored and not considered part of the sample population.
If the elements in the given array are not numbers, they will be coerced to numbers. A copy of the input array is sorted and stored internally.
Array of domain values.
Returns the extent of values in the domain [x0, x1] for the corresponding value in the range: the inverse of quantile. This method is useful for interaction, say to determine the value in the domain that corresponds to the pixel location under the mouse.
A value from the range.
Returns the quantile thresholds. If the range contains n discrete values, the returned array will contain n - 1 thresholds. Values less than the first threshold are considered in the first quantile; values greater than or equal to the first threshold but less than the second threshold are in the second quantile, and so on. Internally, the thresholds array is used with bisect to find the output quantile associated with the given input value.
Returns the current range.
Sets the discrete values in the range. The array must not be empty. The number of values in (the cardinality, or length, of) the range array determines the number of quantiles that are computed.
For example, to compute quartiles, range must be an array of four elements such as [0, 1, 2, 3].
Array of range values.
Returns the current unknown value, which defaults to undefined.
Sets the output value of the scale for undefined (or NaN) input values and returns this scale.
The output value of the scale for undefined (or NaN) input values.
Quantile scales map a sampled input domain to a discrete range. The domain is considered continuous and thus the scale will accept any reasonable input value; however, the domain is specified as a discrete set of sample values. The number of values in (the cardinality of) the output range determines the number of quantiles that will be computed from the domain. To compute the quantiles, the domain is sorted, and treated as a population of discrete values; see d3-array’s quantile.
The first generic corresponds to the data type of range elements.
The second generic corresponds to the data type of the unknown value.