Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LUT <TProps >

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

__@iterator

  • __@iterator(): IterableIterator<[keyof TProps, TProps[keyof TProps]]>
  • Returns IterableIterator<[keyof TProps, TProps[keyof TProps]]>

asImmutable

  • asImmutable(): this
  • see

    Map#asImmutable

    Returns this

asMutable

  • asMutable(): this
  • see

    Map#asMutable

    Returns this

clear

  • clear(): this
  • Returns a new instance of this Record type with all values set to their default values.

    Returns this

delete

  • delete(key: K): this
  • Returns a new instance of this Record type with the value for the specific key set to its default value.

    alias

    remove

    Type parameters

    • K: keyof TProps

    Parameters

    • key: K

    Returns this

deleteIn

  • deleteIn(keyPath: Iterable<any>): this
  • alias

    removeIn

    Parameters

    • keyPath: Iterable<any>

    Returns this

equals

  • equals(other: any): boolean
  • Parameters

    • other: any

    Returns boolean

get

  • get(key: K, notSetValue?: any): TProps[K]
  • get(key: string, notSetValue: T): T
  • Returns the value associated with the provided key, which may be the default value defined when creating the Record factory function.

    If the requested key is not defined by this Record type, then notSetValue will be returned if provided. Note that this scenario would produce an error when using Flow or TypeScript.

    Type parameters

    • K: keyof TProps

    Parameters

    • key: K
    • Optional notSetValue: any

    Returns TProps[K]

  • Type parameters

    • T

    Parameters

    • key: string
    • notSetValue: T

    Returns T

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.

getIn

  • getIn(keyPath: Iterable<any>): any
  • Parameters

    • keyPath: Iterable<any>

    Returns any

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.

has

  • has(key: string): boolean
  • Parameters

    • key: string

    Returns boolean

hasIn

  • hasIn(keyPath: Iterable<any>): boolean
  • Parameters

    • keyPath: Iterable<any>

    Returns boolean

hashCode

  • hashCode(): number
  • Returns number

merge

  • merge(...collections: Array<Partial<TProps> | Iterable<[string, any]>>): this
  • Parameters

    • Rest ...collections: Array<Partial<TProps> | Iterable<[string, any]>>

    Returns this

mergeDeep

  • mergeDeep(...collections: Array<Partial<TProps> | Iterable<[string, any]>>): this
  • Parameters

    • Rest ...collections: Array<Partial<TProps> | Iterable<[string, any]>>

    Returns this

mergeDeepIn

  • mergeDeepIn(keyPath: Iterable<any>, ...collections: Array<any>): this
  • Parameters

    • keyPath: Iterable<any>
    • Rest ...collections: Array<any>

    Returns this

mergeDeepWith

  • mergeDeepWith(merger: function, ...collections: Array<Partial<TProps> | Iterable<[string, any]>>): this
  • Parameters

    • merger: function
        • Parameters

          • oldVal: any
          • newVal: any
          • key: any

          Returns any

    • Rest ...collections: Array<Partial<TProps> | Iterable<[string, any]>>

    Returns this

mergeIn

  • mergeIn(keyPath: Iterable<any>, ...collections: Array<any>): this
  • Parameters

    • keyPath: Iterable<any>
    • Rest ...collections: Array<any>

    Returns this

mergeWith

  • mergeWith(merger: function, ...collections: Array<Partial<TProps> | Iterable<[string, any]>>): this
  • Parameters

    • merger: function
        • Parameters

          • oldVal: any
          • newVal: any
          • key: keyof TProps

          Returns any

    • Rest ...collections: Array<Partial<TProps> | Iterable<[string, any]>>

    Returns this

remove

  • remove(key: K): this
  • Type parameters

    • K: keyof TProps

    Parameters

    • key: K

    Returns this

removeIn

  • removeIn(keyPath: Iterable<any>): this
  • Parameters

    • keyPath: Iterable<any>

    Returns this

set

  • set(key: K, value: TProps[K]): this
  • Type parameters

    • K: keyof TProps

    Parameters

    • key: K
    • value: TProps[K]

    Returns this

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

setIn

  • setIn(keyPath: Iterable<any>, value: any): this
  • Parameters

    • keyPath: Iterable<any>
    • value: any

    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

toJS

  • toJS(): object
  • Deeply converts this Record to equivalent native JavaScript Object.

    Note: This method may not be overridden. Objects with custom serialization to plain JS may override toJSON() instead.

    Returns object

toJSON

  • toJSON(): TProps
  • Shallowly converts this Record to equivalent native JavaScript Object.

    Returns TProps

toObject

  • toObject(): TProps
  • Shallowly converts this Record to equivalent JavaScript Object.

    Returns TProps

toSeq

  • toSeq(): Keyed<keyof TProps, TProps[keyof TProps]>
  • Returns Keyed<keyof TProps, TProps[keyof TProps]>

update

  • update(key: K, updater: function): this
  • Type parameters

    • K: keyof TProps

    Parameters

    • key: K
    • updater: function
        • Parameters

          • value: TProps[K]

          Returns TProps[K]

    Returns this

updateIn

  • updateIn(keyPath: Iterable<any>, updater: function): this
  • Parameters

    • keyPath: Iterable<any>
    • updater: function
        • Parameters

          • value: any

          Returns any

    Returns this

wasAltered

  • wasAltered(): boolean
  • see

    Map#wasAltered

    Returns boolean

withMutations

  • withMutations(mutator: function): this
  • Note: Not all methods can be used on a mutable collection or within withMutations! Only set may be used mutatively.

    see

    Map#withMutations

    Parameters

    • mutator: function
        • Parameters

          • mutable: this

          Returns any

    Returns this

Static Factory

  • Factory(values?: Partial<TProps> | Iterable<[string, any]>): Record<TProps> & Readonly<TProps>
  • Type parameters

    • TProps: Object

    Parameters

    • Optional values: Partial<TProps> | Iterable<[string, any]>

    Returns Record<TProps> & Readonly<TProps>

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>

Static getDescriptiveName

  • getDescriptiveName(record: Record<any>): string
  • Records allow passing a second parameter to supply a descriptive name that appears when converting a Record to a string or in any error messages. A descriptive name for any record can be accessed by using this method. If one was not provided, the string "Record" is returned.

    const { Record } = require('immutable')
    const Person = Record({
      name: null
    }, 'Person')
    
    var me = Person({ name: 'My Name' })
    me.toString() // "Person { "name": "My Name" }"
    Record.getDescriptiveName(me) // "Person"

    Parameters

    • record: Record<any>

    Returns string

Static isRecord

  • isRecord(maybeRecord: any): boolean
  • True if maybeRecord is an instance of a Record.

    Parameters

    • maybeRecord: any

    Returns boolean