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

Threshold scales are similar to quantize scales, except they allow you to map arbitrary subsets of the domain to discrete values in the range. The input domain is still continuous, and divided into slices based on a set of threshold values.

If the number of values in the scale’s range is N+1, the number of values in the scale’s domain must be N. If there are fewer than N elements in the domain, the additional values in the range are ignored. If there are more than N elements in the domain, the scale may return undefined for some inputs.

The first generic corresponds to the data type of domain values. The second generic corresponds to the data type of range values.

Type parameters

  • Domain: number | string | Date

  • Range

Hierarchy

  • ScaleThreshold

Callable

  • __call(value: Domain): Range
  • Given a value in the input domain, returns the corresponding value in the output range.

    If the number of values in the scale’s range is N+1, the number of values in the scale’s domain must be N. If there are fewer than N elements in the domain, the additional values in the range are ignored. If there are more than N elements in the domain, the scale may return undefined for some inputs.

    The first generic corresponds to the data type of domain values. The second generic corresponds to the data type of range values.

    Parameters

    • value: Domain

      A domain value.

    Returns Range

Index

Methods

copy

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

domain

  • domain(): Domain[]
  • domain(domain: Domain[])
  • Returns the scale’s current domain.

    Returns Domain[]

  • Sets the scale’s domain to the specified array of values. The values must be in sorted ascending order, or the behavior of the scale is undefined. The values are typically numbers, but any naturally ordered values (such as strings) will work; a threshold scale can be used to encode any type that is ordered. If the number of values in the scale’s range is N+1, the number of values in the scale’s domain must be N. If there are fewer than N elements in the domain, the additional values in the range are ignored. If there are more than N elements in the domain, the scale may return undefined for some inputs.

    Parameters

    • domain: Domain[]

      Array of domain values.

invertExtent

  • invertExtent(value: Range): [Domain | undefined, Domain | undefined]
  • Returns the extent of values in the domain [x0, x1] for the corresponding value in the range, representing the inverse mapping from range to domain. This method is useful for interaction, say to determine the value in the domain that corresponds to the pixel location under the mouse.

    Parameters

    • value: Range

      A range value.

    Returns [Domain | undefined, Domain | undefined]

range

  • range(): Range[]
  • range(range: Range[])
  • Returns the scale’s current range.

    Returns Range[]

  • Sets the scale’s range to the specified array of values. If the number of values in the scale’s domain is N, the number of values in the scale’s range must be N+1. If there are fewer than N+1 elements in the range, the scale may return undefined for some inputs. If there are more than N+1 elements in the range, the additional values are ignored.

    Parameters

    • range: Range[]

      Array of range values.

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