Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LUT

Lookup Table class stores information about values and its associated colors. It provides efficient lookup of the color based on provided value as well as linear and step interpolation between colors.

Instances of LUT are immutable, meaning that its setters don't modify the object, but instead return a completely new modified object.

PieChart, DonutChart, GaugeChart: When this LUT is set, the Charts will colorize the Slices based on Value property of the slice.

Can be used in PalettedFill style to colorize the data based on value.

Index

Constructors

constructor

  • Create a new color-value lookup table using LUTOptions.

    Example:

    // create LUT from 0..100 with gradient steps.
    const lut = new LUT( {
     steps: [
          { value: 0, color: ColorRGBA( 0, 0, 0 ) },
          { value: 30, color: ColorRGBA( 255, 255, 0 ) },
          { value: 45, color: ColorRGBA( 255, 204, 0 ) },
          { value: 60, color: ColorRGBA( 255, 128, 0 ) },
          { value: 100, color: ColorRGBA( 255, 0, 0 ) }
       ],
     interpolate: true
     } )

    Parameters

    • options: LUTOptions

      Object containing parameters for creation of the LUT.

    Returns LUT

Methods

getColors

  • getColors(values: number): Color
  • getColors(values: number[]): Color[]
  • getColors(values: number[][]): Color[][]
  • Get the color associated with the given value.

    Example:

    const color = lut.getColors( 5 )

    Parameters

    • values: number

      Single value.

    Returns Color

    Associated color if the LUT is valid, otherwise fallback color.

  • Get the colors associated with the given collection of values.

    Example:

    const colors = lut.getColors( [ 5, 10, 15 ] )

    Parameters

    • values: number[]

      1D collection of value.

    Returns Color[]

    Collection of associated colors if the LUT is valid, otherwise fallback colors.

  • Get the colors associated with the given collection Matrix2D of values.

    Example:

    const colors = lut.getColors(
     [
       [ 3, 7, 9 ],
       [ 5, 10, 15 ]
     ]
    )

    Parameters

    • values: number[][]

      2D collection of values.

    Returns Color[][]

    Collection of associated colors if the LUT is valid, otherwise fallback colors.

getFallbackColor

  • getFallbackColor(): Color
  • Get fallback color of value the LUT.

    Returns Color

    Color object.

getInterpolation

  • getInterpolation(): boolean
  • Get interpolation behavior of the LUT.

    Returns boolean

    Intepolation behaviour state. True - gradient, False - uniform.

getSteps

  • Get collection of LUT steps.

    Returns LUTStep[]

    Collection of steps.

getTitle

  • getTitle(): string
  • Get title of the LUT.

    Returns string

    Title of the LUT as string.

getUnits

  • getUnits(): string
  • Get units of the LUT.

    Returns string

    Units of the LUT as string.

setFallbackColor

  • setFallbackColor(color: Color): this
  • Set fallback color. The following color would be used as a backup. Meaning, the LUT might be configured incorrectly or the data is incorrect.

    Parameters

    • color: Color

      Color object.

    Returns this

setInterpolation

  • setInterpolation(interpolate: boolean): this
  • Set interpolation behavior of the LUT, which describes the distribution of color for the data:

    • True: creates a gradient LUT using linear-interpolation (LERP) between colors, which were defined in the collection of steps.
    • False: creates a uniform LUT using step-function for each color to describe the range of values where this color is used.

    Parameters

    • interpolate: boolean

      Interpolation behavior: True - gradient, False - uniform.

    Returns this

setSteps

  • Set new collection of LUT steps.

    Parameters

    • steps: LUTStep[]

      Collection of color-value pairs.

    Returns this

setTitle

  • setTitle(title: string): this
  • Set title of the LUT, which describes the data.

    Parameters

    • title: string

      Title of the LUT.

    Returns this

setUnits

  • setUnits(units: string): this
  • Set units of the data-values in the LUT, which describes the data domain.

    Parameters

    • units: string

      Units of the LUT.

    Returns this

Static Record

  • Record(defaultValues: TProps, name?: undefined | string): Factory<TProps>
  • Unlike other types in Immutable.js, the Record() function creates a new Record Factory, which is a function that creates Record instances.

    See above for examples of using Record().

    Note: Record is a factory function and not a class, and does not use the new keyword during construction.

    Type parameters

    • TProps

    Parameters

    • defaultValues: TProps
    • Optional name: undefined | string

    Returns Factory<TProps>