Style class for describing a table of colors with associated lookup values (numbers).

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

Properties of LUT:

  • steps: List of color steps (color + number value pair).
  • interpolate: true enables automatic linear interpolation between color steps.

LUT Behavior:

Example 1, LUT with interpolation disabled.

 const lut = new LUT({
steps: [
{ value: 0, color: ColorRGBA( 0, 0, 0 ) },
{ value: 10, color: ColorRGBA( 255, 0, 0 ) },
{ value: 100, color: ColorRGBA( 0, 255, 0 ) }
],
interpolate: false
})
Lookup Value Color
value < 10 black
10 <= value < 100 red
100 <= value green

Example 2, LUT with interpolation enabled.

 const lut = new LUT({
steps: [
{ value: 0, color: ColorRGBA( 0, 0, 0 ) },
{ value: 10, color: ColorRGBA( 255, 0, 0 ) },
{ value: 100, color: ColorRGBA( 0, 255, 0 ) }
],
interpolate: true
})
Lookup Value Color
value <= 0 black
0 < value < 10 interpolated between black and red
10 < value < 100 interpolated between red and green

LUT Usage:

Use LUT with:

  • PalettedFill for styling series based on different lookup values (user supplied data, x/y/z coordinates, ...)
  • Sliced charts for styling slices dynamically based on their value

Hierarchy

  • LUTRecord
    • LUT

Constructors

  • Construct a LUT object, specifying any amount of its properties.

    Example 1, LUT with interpolation disabled.

     const lut = new LUT({
    steps: [
    { value: 0, color: ColorRGBA( 0, 0, 0 ) },
    { value: 10, color: ColorRGBA( 255, 0, 0 ) },
    { value: 100, color: ColorRGBA( 0, 255, 0 ) }
    ],
    interpolate: false
    })

    Example 2, LUT with interpolation enabled.

     const lut = new LUT({
    steps: [
    { value: 0, color: ColorRGBA( 0, 0, 0 ) },
    { value: 10, color: ColorRGBA( 255, 0, 0 ) },
    { value: 100, color: ColorRGBA( 0, 255, 0 ) }
    ],
    interpolate: true
    })

    Parameters

    Returns LUT

Properties

color: Color

Fallback color, which is used if LUT steps are defined as empty or defined incorrectly.

Default value: Black.

interpolate: boolean

Interpolation behavior of the LUT, which describes the distribution of color for the data:

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

Default value: true.

isValid: boolean

Validation flag which describes that the LUT is configured correctly.

length: number

Amount of LUT steps.

max: number

Maximal value of the entire LUT.

min: number

Minimal value of the entire LUT.

steps: LUTStep[]

The collection of LUTSteps, which specifies the colors and their corresponding values to describe the location and color of a transition point in a gradient. Each represented as a pair object {value: number, color: Color}.

Default value: [].

subranges: SubRange[]

Collection of subranges.

title: string

Title of the LUT, which describes the visualization.

Default value: Empty string.

units: string

Units of the data-values in the LUT, which describes the data domain.

Default value: Empty string.

Methods

  • Get the color associated with the given value.

    Example:

    const color = lut.getColors( 5 )
    

    Returns

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

    Parameters

    • values: number

      Single value.

    Returns Color

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

    Example:

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

    Returns

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

    Parameters

    • values: number[]

      1D collection of value.

    Returns Color[]

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

    Example:

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

    Returns

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

    Parameters

    • values: number[][]

      2D collection of values.

    Returns Color[][]

  • Get fallback color of value the LUT.

    Returns

    Color object.

    Returns Color

  • Get interpolation behavior of the LUT.

    Returns

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

    Returns boolean

  • Get collection of LUT steps.

    Returns

    Collection of steps.

    Returns LUTStep[]

  • Get title of the LUT.

    Returns

    Title of the LUT as string.

    Returns string

  • Get units of the LUT.

    Returns

    Units of the LUT as string.

    Returns string

  • 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 LUT

  • 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 LUT

  • Set new collection of LUT steps.

    Parameters

    • steps: LUTStep[]

      Collection of color-value pairs.

    Returns LUT

  • Set title of the LUT, which describes the data.

    Parameters

    • title: string

      Title of the LUT.

    Returns LUT

  • Set units of the data-values in the LUT, which describes the data domain.

    Parameters

    • units: string

      Units of the LUT.

    Returns LUT