Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

ScaleQuantile

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.

interface ScaleQuantile <Range, Unknown = never> {
(value: NumberValue): Range | Unknown;
copy(): this;
domain(): number[];
domain(domain: Iterable<NumberValue | null | undefined>): this;
invertExtent(value: Range): [number, number];
quantiles(): number[];
range(): Range[];
range(range: Iterable<Range>): this;
unknown(): UnknownReturnType<Unknown, undefined>;
unknown<NewUnknown>(value: NewUnknown): ScaleQuantile<Range, NewUnknown>;
}

§Type Parameters

§
Range
[src]
§
Unknown = never
[src]

§Call Signatures

§
(value: NumberValue): Range | Unknown
[src]

Given a value in the input domain, returns the corresponding value in the output range.

§Methods

§
copy(): this
[src]

Returns an exact copy of this scale. Changes to this scale will not affect the returned scale, and vice versa.

§
domain(): number[]
[src]

Returns the scale’s current domain.

§
domain(domain: Iterable<NumberValue | null | undefined>): this
[src]

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.

@param domain

Array of domain values.

§
invertExtent(value: Range): [number, number]
[src]

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.

@param value

A value from the range.

§
quantiles(): number[]
[src]

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.

§
range(): Range[]
[src]

Returns the current range.

§
range(range: Iterable<Range>): this
[src]

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].

@param range

Array of range values.

§
unknown(): UnknownReturnType<Unknown, undefined>
[src]

Returns the current unknown value, which defaults to undefined.

§
unknown<NewUnknown>(value: NewUnknown): ScaleQuantile<Range, NewUnknown>
[src]

Sets the output value of the scale for undefined (or NaN) input values and returns this scale.

@param value

The output value of the scale for undefined (or NaN) input values.