WebCola
Options
All
  • Public
  • Public/Protected
  • All
Menu

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 output range of a sequential scale is fixed by its interpolator and not configurable.

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

Type parameters

  • Output

Hierarchy

  • ScaleSequential

Callable

  • __call(value: number | object): Output
  • 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

    • value: number | object

      A numeric value from the domain.

    Returns Output

Index

Methods

clamp

  • clamp(): boolean
  • clamp(clamp: boolean)
  • 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.

copy

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

    Returns ScaleSequential<Output>

domain

  • domain(): [number, number]
  • domain(domain: [number | object, number | object])
  • 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: [number | object, number | object]

      A two-element array of numeric domain values.

interpolator

  • interpolator(): function
  • interpolator(interpolator: function)
  • interpolator<NewOutput>(interpolator: function): ScaleSequential<NewOutput>
  • Returns the current interpolator underlying the scale.

    Returns function

      • (t: number): Output
      • Parameters

        • t: number

        Returns Output

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

    Parameters

    • interpolator: function

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

        • (t: number): Output
        • Parameters

          • t: number

          Returns Output

  • 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: function

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

        • (t: number): NewOutput
        • Parameters

          • t: number

          Returns NewOutput

    Returns ScaleSequential<NewOutput>

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc