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
} )
Object containing parameters for creation of the LUT.
Returns a new instance of this Record type with all values set to their default values.
Returns a new instance of this Record type with the value for the specific key set to its default value.
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.
Get the color associated with the given value.
Example:
const color = lut.getColors( 5 )
Single value.
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 ] )
1D collection of value.
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 ]
]
)
2D collection of values.
Collection of associated colors if the LUT is valid, otherwise fallback colors.
Get fallback color of value the LUT.
Color object.
Get interpolation behavior of the LUT.
Intepolation behaviour state. True - gradient, False - uniform.
Get collection of LUT steps.
Collection of steps.
Get title of the LUT.
Title of the LUT as string.
Get units of the LUT.
Units of the LUT as 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.
Color object.
Set interpolation behavior of the LUT, which describes the distribution of color for the data:
Interpolation behavior: True - gradient, False - uniform.
Set new collection of LUT steps.
Collection of color-value pairs.
Set title of the LUT, which describes the data.
Title of the LUT.
Set units of the data-values in the LUT, which describes the data domain.
Units of the LUT.
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.
Shallowly converts this Record to equivalent native JavaScript Object.
Shallowly converts this Record to equivalent JavaScript Object.
Note: Not all methods can be used on a mutable collection or within
withMutations! Only set may be used mutatively.
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.
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"
True if maybeRecord is an instance of a Record.
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.