Interface ScaleSequentialQuantile<Output, Unknown>

Sequential scales are similar to continuous scales in that they map a continuous, numeric input domain to a continuous output range. However, unlike continuous scales, the input domain and output range of a sequential scale always has exactly two elements, and the output range is typically specified as an interpolator rather than an array of values. These scales do not expose invert and interpolate methods.

The first generic corresponds to the data type of the output of the interpolator underlying the scale.

The second generic corresponds to the data type of the unknown value.

interface ScaleSequentialQuantile {
    clamp(): boolean;
    clamp(clamp): ScaleSequentialQuantile<Output, Unknown>;
    copy(): ScaleSequentialQuantile<Output, Unknown>;
    domain(): [number, number];
    domain(domain): ScaleSequentialQuantile<Output, Unknown>;
    interpolator(): ((t) => Output);
    interpolator(interpolator): ScaleSequentialQuantile<Output, Unknown>;
    interpolator<NewOutput>(interpolator): ScaleSequentialQuantile<NewOutput, Unknown>;
    quantiles(): number[];
    range(): (() => [Output, Output]);
    range(range): ScaleSequentialQuantile<Output, Unknown>;
    rangeRound(range): ScaleSequentialQuantile<Output, Unknown>;
    unknown(): UnknownReturnType<Unknown, undefined>;
    unknown<NewUnknown>(value): ScaleSequentialQuantile<Output, NewUnknown>;
    (value): Output | Unknown;
}

Type Parameters

  • Output

  • Unknown = never

Hierarchy

  • Given a value from the domain, returns the corresponding value from the output range, subject to interpolation.

    If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range.

    Parameters

    Returns Output | Unknown

Methods

  • Returns whether or not the scale currently clamps values to within the range.

    Returns boolean

  • Enables or disables clamping, respectively. If clamping is disabled and the scale is passed a value outside the domain, the scale may return a value outside the range through extrapolation.

    If clamping is enabled, the return value of the scale is always within the scale’s range. Clamping similarly applies to the "invert" method.

    Parameters

    • clamp: boolean

      A flag to enable (true) or disable (false) clamping.

    Returns ScaleSequentialQuantile<Output, Unknown>

  • Returns a copy of the scale’s current domain.

    Returns [number, number]

  • Sets the scale’s domain to the specified array of numbers. The array must contain exactly two elements. If the elements in the given array are not numbers, they will be coerced to numbers

    Parameters

    • domain: Iterable<NumberValue>

      A two-element array of numeric domain values.

    Returns ScaleSequentialQuantile<Output, Unknown>

  • Returns the current interpolator underlying the scale.

    Returns ((t) => Output)

      • (t): Output
      • Returns the current interpolator underlying the scale.

        Parameters

        • t: number

        Returns Output

  • Sets the scale’s interpolator to the specified function.

    Parameters

    • interpolator: ((t) => Output)

      An interpolator function mapping a value from the [0, 1] interval to an output value.

        • (t): Output
        • Parameters

          • t: number

          Returns Output

    Returns ScaleSequentialQuantile<Output, Unknown>

  • Sets the scale’s interpolator to the specified function.

    The generic corresponds to a the new output type of the scale. The output type of the scale is determined by the output type of the interpolator function.

    Type Parameters

    • NewOutput

    Parameters

    • interpolator: ((t) => NewOutput)

      An interpolator function mapping a value from the [0, 1] interval to an output value.

        • (t): NewOutput
        • Parameters

          • t: number

          Returns NewOutput

    Returns ScaleSequentialQuantile<NewOutput, Unknown>

  • Returns an array of n + 1 quantiles. For example, if n = 4, returns an array of five numbers: the minimum value, the first quartile, the median, the third quartile, and the maximum.

    Returns number[]

  • See continuous.range.

    Returns (() => [Output, Output])

      • (): [Output, Output]
      • See continuous.range.

        Returns [Output, Output]

  • See continuous.range. The given two-element array is converted to an interpolator function using d3.interpolate.

    Parameters

    • range: Iterable<Output>

      Range values.

    Returns ScaleSequentialQuantile<Output, Unknown>

  • Returns the current unknown value, which defaults to undefined.

    Returns UnknownReturnType<Unknown, undefined>

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

    Type Parameters

    • NewUnknown

    Parameters

    • value: NewUnknown

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

    Returns ScaleSequentialQuantile<Output, NewUnknown>