LookupTable

Represents a lookup table for colormaps. It is used to determine the color values from a range of data values.

Example

var lut = new v3d.Lut("rainbow", 512); var data = [0, 10.1, 4.2, 3.4, 63, 28]; lut.setMax(63); color = lut.getColor(10);

Constructor

LookupTable(colormap, numberOfColors)

colormap - optional argument that sets a colormap from predefined colormaps. Available colormaps are : "rainbow", "cooltowarm", "blackbody". numberOfColors - optional argument that sets the number of colors used to represent the data array.

Properties

.minV : Float

The minimum value to be represented with the lookup table. Default is 0.

.maxV : Float

The maximum value to be represented with the lookup table. Default is 1.

.[legend]

The legend of the lookup table.

Methods

.copy (lut : Lut) : null this : Lut

color — Lut to copy.

Copies given lut.

.setLegendOn [parameters]

parameters - { layout: value, position: { x: value, y: value, z: value }, dimensions: { width: value, height: value } } layout — Horizontal or vertical layout. Default is vertical.
position — The position x,y,z of the legend.
dimensions — The dimensions (width and height) of the legend.

Sets this Lut with the legend on.

.setLegendOff

Sets this Lut with the legend off.

.setLegendLabels [parameters, callback]

parameters - { fontsize: value, fontface: value, title: value, um: value, ticks: value, decimal: value, notation: value } fontsize — Font size to be used for labels.
fontface — Font type to be used for labels.
title — The title of the legend.
um — The unit of measurements of the legend.
ticks — The number of ticks to be displayed.
decimal — The number of decimals to be used for legend values.
notation — Legend notation: standard (default) or scientific.
callback — An optional callback to be used to format the legend labels.

Sets the labels of the legend of this Lut.

.setMin (minV : Float) : Lut

minV — The minimum value to be represented with the lookup table.

Sets this Lut with the minimum value to be represented.

.setMax (maxV : Float) : Lut

maxV — The maximum value to be represented with the lookup table.

Sets this Lut with the maximum value to be represented.

.changeNumberOfColors (numberOfColors : Float) : Lut

numberOfColors — The number of colors to be used to represent the data array.

Sets this Lut with the number of colors to be used.

.changeColorMap (colorMap : Float) : Lut

colorMap — The name of the color map to be used to represent the data array.

Sets this Lut with the colormap to be used.

.addColorMap (colorMapName, arrayOfColors) : Lut

Insert a new color map into the set of available color maps.

.getColor (value) : Lut this : Lut

value -- the data value to be displayed as a color.

Returns a Color.

Source

For more info on how to obtain the source code of this module see this page.