Class: ColorMap

image.ColorMap(params)

new ColorMap(params)

Create the color map to be used with module:image.createImage. Currently, this class is not used except by module:image.createImage. Methods such as getImage and Image#setColorMap have all been replaced by directly specifying a ColorMapObject, and there is a possibility of significant specification changes or discontinuation in the future.
Parameters:
Name Type Description
params Object Conditions for creating an instance
Properties
Name Type Description
colorMap ColorMapObject Conditions for the colormap used in visualization
See:

Methods

get(x) → {Uint8ClampedArray}

Obtains the color code of the color to be painted on the specified value as a Uint8ClampedArray.
Parameters:
Name Type Description
x number Value for the color
Returns:
This is converting the color code RRGGBBAA to new Uint8ClampedArray([r,g,b,a]).
Type
Uint8ClampedArray

getColorBar(width, height) → {HTMLCanvasElement}

Creates an HTMLCanvasElement that draws a gradient image according to a colormap name or an array of color codes. When writing scale numbers or units, please use getLegend.
Parameters:
Name Type Description
width number Number of pixels in width
height number Number of pixels in height
Returns:
HTMLCanvasElement that draws a gradient image
Type
HTMLCanvasElement

getColors() → {string|Array.<string>}

Obtains an array of color map names or color codes.
Returns:
An array of color map names or color codes
Type
string | Array.<string>

getDeleteMax() → {boolean}

Retrieves the setting for whether to make values below the maximum transparent.
Returns:
The setting for whether to make values below the maximum transparent
Type
boolean

getDeleteMin() → {boolean}

Retrieves the setting for whether to make values below the minimum transparent.
Returns:
The setting for whether to make values below the minimum transparent
Type
boolean

getLegend(width, height, fontSize, unitopt) → {HTMLCanvasElement}

Creates an HTMLCanvasElement that draws an image of the legend.
Parameters:
Name Type Attributes Description
width number Width of the legend image (in pixels)
height number Height of the legend image (in pixels)
fontSize number Text size within the legend image (in pixels)
unit string <optional>
The unit string to be displayed inside the legend image
Returns:
An HTMLCanvasElement that draws an image of the legend
Type
HTMLCanvasElement

getMax() → {number}

Retrieves the maximum value of the area to be colored.
Returns:
Maximum range for coloring
Type
number

getMin() → {number}

Retrieves the minimum value of the area to be colored.
Returns:
Minimum range for coloring
Type
number

getNaNColor() → {Uint8ClampedArray}

Obtain the color code of the color to paint NaN as a Uint8ClampedArray.
Returns:
The color code RRGGBBAA for the color to be painted on the NaN, converted to new Uint8ClampedArray([r,g,b,a])
Type
Uint8ClampedArray

getParams() → {ColorMapObject}

Retrieves all the settings as a ColorMapObject. However, nanColor has been replaced with Uint8ClampedArray.
Returns:
ColorMapObject of the configuration content
Type
ColorMapObject