Class ColorRamp
Hierarchy
- Array<ColorStop>
- ColorRamp
Indexable
Index
Constructors
Properties
Methods
Constructors
constructor
Parameters
Optionaloptions: ColorRampOptions
Returns ColorRamp
Properties
Readonly[unscopables]
"[iterator]"?: boolean;
"[unscopables]"?: boolean;
at?: boolean;
concat?: boolean;
copyWithin?: boolean;
entries?: boolean;
every?: boolean;
fill?: boolean;
filter?: boolean;
find?: boolean;
findIndex?: boolean;
flat?: boolean;
flatMap?: boolean;
forEach?: boolean;
includes?: boolean;
indexOf?: boolean;
join?: boolean;
keys?: boolean;
lastIndexOf?: boolean;
length?: boolean;
map?: boolean;
pop?: boolean;
push?: boolean;
reduce?: boolean;
reduceRight?: boolean;
reverse?: boolean;
shift?: boolean;
slice?: boolean;
some?: boolean;
sort?: boolean;
splice?: boolean;
toLocaleString?: boolean;
toString?: boolean;
unshift?: boolean;
values?: boolean;
[key: number]: boolean | undefined;
}
Type Declaration
[key: number]: boolean | undefined
Optional[iterator]?: booleanOptionalReadonly[unscopables]?: booleanIs an object whose properties have the value 'true' when they will be absent when used in a 'with' statement.
Optionalat?: booleanOptionalconcat?: booleanOptionalcopyWithin?: booleanOptionalentries?: booleanOptionalevery?: booleanOptionalfill?: booleanOptionalfilter?: booleanOptionalfind?: booleanOptionalfindIndex?: booleanOptionalflat?: booleanOptionalflatMap?: booleanOptionalforEach?: booleanOptionalincludes?: booleanOptionalindexOf?: booleanOptionaljoin?: booleanOptionalkeys?: booleanOptionallastIndexOf?: booleanOptionallength?: booleanGets or sets the length of the array. This is a number one higher than the highest index in the array.
Optionalmap?: booleanOptionalpop?: booleanOptionalpush?: booleanOptionalreduce?: booleanOptionalreduceRight?: booleanOptionalreverse?: booleanOptionalshift?: booleanOptionalslice?: booleanOptionalsome?: booleanOptionalsort?: booleanOptionalsplice?: booleanOptionaltoLocaleString?: booleanOptionaltoString?: booleanOptionalunshift?: booleanOptionalvalues?: boolean
length
Gets or sets the length of the array. This is a number one higher than the highest index in the array.
Static Readonly[species]
Staticbuiltin
AUTOMN: ColorRamp;
BATHYMETRY: ColorRamp;
BLACKBODY: ColorRamp;
BLUERED: ColorRamp;
BONE: ColorRamp;
CDOM: ColorRamp;
CHLOROPHYLL: ColorRamp;
CIVIDIS: ColorRamp;
COOL: ColorRamp;
COPPER: ColorRamp;
CUBEHELIX: ColorRamp;
DENSITY: ColorRamp;
EARTH: ColorRamp;
ELECTRIC: ColorRamp;
FREESURFACE_BLUE: ColorRamp;
FREESURFACE_RED: ColorRamp;
GREENS: ColorRamp;
GREYS: ColorRamp;
HOT: ColorRamp;
HSV: ColorRamp;
INFERNO: ColorRamp;
JET: ColorRamp;
MAGMA: ColorRamp;
MAKO: ColorRamp;
MAKO_PRECIPITATION: ColorRamp;
NULL: ColorRamp;
OXYGEN: ColorRamp;
PAR: ColorRamp;
PHASE: ColorRamp;
PICNIC: ColorRamp;
PLASMA: ColorRamp;
PORTLAND: ColorRamp;
PRECIPITATION: ColorRamp;
PRECIPITATION_2: ColorRamp;
PRESSURE: ColorRamp;
PRESSURE_2: ColorRamp;
PRESSURE_3: ColorRamp;
PRESSURE_4: ColorRamp;
PRESSURE_CIVIDIS: ColorRamp;
RADAR: ColorRamp;
RADAR_CLOUD: ColorRamp;
RADAR_ROCKET: ColorRamp;
RAINBOW: ColorRamp;
RAINBOW_SOFT: ColorRamp;
RDBU: ColorRamp;
ROCKET: ColorRamp;
SALINITY: ColorRamp;
SPRING: ColorRamp;
SUMMER: ColorRamp;
TEMPERATURE: ColorRamp;
TEMPERATURE_2: ColorRamp;
TEMPERATURE_3: ColorRamp;
TEMPERATURE_TURBO: ColorRamp;
TERRAIN: ColorRamp;
TURBIDITY: ColorRamp;
TURBO: ColorRamp;
VELOCITY_BLUE: ColorRamp;
VELOCITY_GREEN: ColorRamp;
VIRIDIS: ColorRamp;
WARM: ColorRamp;
WIND_ROCKET: ColorRamp;
WINTER: ColorRamp;
YIGNBU: ColorRamp;
YIORRD: ColorRamp;
}
Type Declaration
AUTOMN: ColorRamp
Classic autommn color ramp. Defined in interval [0, 1], without unit.
BATHYMETRY: ColorRamp
Classic bathymetry color ramp. Defined in interval [0, 1], without unit.
BLACKBODY: ColorRamp
Classic blackbody color ramp. Defined in interval [0, 1], without unit.
BLUERED: ColorRamp
Classic blue-red color ramp. Defined in interval [0, 1], without unit.
BONE: ColorRamp
Classic bone color ramp. Defined in interval [0, 1], without unit.
CDOM: ColorRamp
Classic cdom color ramp. Defined in interval [0, 1], without unit.
CHLOROPHYLL: ColorRamp
Classic chlorophyll color ramp. Defined in interval [0, 1], without unit.
CIVIDIS: ColorRamp
The cividis color ramp is color blind friendly. Read more here https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0199239 Defined in interval [0, 1], without unit.
COOL: ColorRamp
Classic cool color ramp. Defined in interval [0, 1], without unit.
COPPER: ColorRamp
Classic copper color ramp. Defined in interval [0, 1], without unit.
CUBEHELIX: ColorRamp
Classic cube helix color ramp. Defined in interval [0, 1], without unit.
DENSITY: ColorRamp
Classic density color ramp. Defined in interval [0, 1], without unit.
EARTH: ColorRamp
Classic earth color ramp. Defined in interval [0, 1], without unit.
ELECTRIC: ColorRamp
Classic electric color ramp. Defined in interval [0, 1], without unit.
FREESURFACE_BLUE: ColorRamp
Classic freesurface blue color ramp. Defined in interval [0, 1], without unit.
FREESURFACE_RED: ColorRamp
Classic freesurface red color ramp. Defined in interval [0, 1], without unit.
GREENS: ColorRamp
Classic greens color ramp. Defined in interval [0, 1], without unit.
GREYS: ColorRamp
Classic greys color ramp. Defined in interval [0, 1], without unit.
HOT: ColorRamp
Classic hot color ramp. Defined in interval [0, 1], without unit.
HSV: ColorRamp
Classic HSV color ramp (hue, saturation, value). Defined in interval [0, 1], without unit.
INFERNO: ColorRamp
Classic inferno color ramp. Defined in interval [0, 1], without unit.
JET: ColorRamp
Classic jet color ramp. Defined in interval [0, 1], without unit.
MAGMA: ColorRamp
Classic magma color ramp. Defined in interval [0, 1], without unit.
MAKO: ColorRamp
The mako color ramp is perceptually uniform and can be seen as a color blind friendly alternative to bathymetry or yignbu. Defined in interval [0, 1], without unit.
MAKO_PRECIPITATION: ColorRamp
This mako color ramps is scale for precipitation is a color blind friendly alternative. Values are in mm/hour Defined in interval [0, 50].
NULL: ColorRamp
A fully transparent [0, 0, 0, 0] colorramp to hide data. Defined in interval [0, 1], without unit.
OXYGEN: ColorRamp
Classic oxygen color ramp. Defined in interval [0, 1], without unit.
PAR: ColorRamp
Classic par color ramp. Defined in interval [0, 1], without unit.
PHASE: ColorRamp
Classic phase color ramp. Defined in interval [0, 1], without unit.
PICNIC: ColorRamp
Classic picnic color ramp. Defined in interval [0, 1], without unit.
PLASMA: ColorRamp
Classic plasma color ramp. Defined in interval [0, 1], without unit.
PORTLAND: ColorRamp
Classic Portland color ramp. Defined in interval [0, 1], without unit.
PRECIPITATION: ColorRamp
Precipitation in mm per hour. Defined in interval [0, 50].
PRECIPITATION_2: ColorRamp
precipitation in mm per hour. Defined in interval [0, 50].
PRESSURE: ColorRamp
Atmospheric pressure, values in hPa (or millibar) Defined in interval [900, 1080].
PRESSURE_2: ColorRamp
Atmospheric pressure, values in hPa (or millibar). Defined in interval [900, 1080].
PRESSURE_3: ColorRamp
Atmospheric pressure, values in hPa (or millibar). Defined in interval [900, 1080].
PRESSURE_4: ColorRamp
Atmospheric pressure, values in hPa (or millibar). Defined in interval [900, 1080]. The main difference with PRESSURE_3 is the true neutral zone (pale gray) from 1012.5 to 1013.5hPa
PRESSURE_CIVIDIS: ColorRamp
This atmospheric pressure color ramp is based on cividis, hence it is more clor bliend friendly. Values are in hPa (or millibar). Defined in interval [900, 1080].
RADAR: ColorRamp
Radar color ramp from NOAA in dBZ. Defined in interval [0, 75].
RADAR_CLOUD: ColorRamp
Intended to be used with Radar data to create a slighly blue-tinted greyscale to represent cloud coverage. Values are in dBZ. Defined in interval [4, 60].
RADAR_ROCKET: ColorRamp
This rocket color ramp scaled for radar data is a color blind friendly alternative. Values are in dBZ. Defined in interval [0, 75]
RAINBOW: ColorRamp
Classic rainbow color ramp. Defined in interval [0, 1], without unit.
RAINBOW_SOFT: ColorRamp
Classic rainboz soft color ramp. Defined in interval [0, 1], without unit.
RDBU: ColorRamp
Classic rdbu color ramp. Defined in interval [0, 1], without unit.
ROCKET: ColorRamp
The rocket color ramp is perceptually uniform, which makes it more color bliend friendly than the classic magma color ramp. Defined in interval [0, 1], without unit.
SALINITY: ColorRamp
Classic salinity color ramp. Defined in interval [0, 1], without unit.
SPRING: ColorRamp
Classic spring color ramp. Defined in interval [0, 1], without unit.
SUMMER: ColorRamp
Classic summer color ramp. Defined in interval [0, 1], without unit.
TEMPERATURE: ColorRamp
Classic temperature color ramp. Defined in interval [0, 1], without unit.
TEMPERATURE_2: ColorRamp
Temperatures in degree Celsius. Defined in interval [-70.15, 46.85].
TEMPERATURE_3: ColorRamp
Temperatures in degrees Celsius. Defined in interval [-65, 55].
TEMPERATURE_TURBO: ColorRamp
Based on the turbo color ramp, this one is scaled to render temperatures in degree Celcius. This is a perceptually uniform alternative to jet, making it more color bliend friendly. Defined in interval [-65, 55].
TERRAIN: ColorRamp
Elevation terrain, values are in meter. Defined in interval [-10001, 8000].
TURBIDITY: ColorRamp
Classic turbidity color ramp. Defined in interval [0, 1], without unit.
TURBO: ColorRamp
Classic turbo color ramp. This is a luminance-constant alternative to the jet, making it more clor-blind friendly. Defined in interval [0, 1], without unit.
VELOCITY_BLUE: ColorRamp
Classic velocity blue color ramp. Defined in interval [0, 1], without unit.
VELOCITY_GREEN: ColorRamp
Classic velocity green color ramp. Defined in interval [0, 1], without unit.
VIRIDIS: ColorRamp
Classic viridis color ramp. Defined in interval [0, 1], without unit.
WARM: ColorRamp
Classic warm color ramp. Defined in interval [0, 1], without unit.
WIND_ROCKET: ColorRamp
This rocket color ramp scaled for wind speed is a color blind friendly alternative. Values are in m/sec. Defined in interval [0, 30]
WINTER: ColorRamp
Classic winter color ramp. Defined in interval [0, 1], without unit.
YIGNBU: ColorRamp
Classic yignbu color ramp (blue to light yellow). Defined in interval [0, 1], without unit.
YIORRD: ColorRamp
Classic yiorrd color ramp (red to light yellow). Defined in interval [0, 1], without unit.
Methods
[iterator]
Iterator
Returns ArrayIterator<ColorStop>
at
Parameters
- pos: number
Returns ColorStop
clone
Returns ColorRamp
concat
copyWithin
Returns the this object after copying a section of the array identified by start and end to the same array starting at position target
Parameters
- target: number
If target is negative, it is treated as length+target where length is the length of the array.
- start: number
If start is negative, it is treated as length+start. If end is negative, it is treated as length+end.
Optionalend: numberIf not specified, length of the this object is used as its default value.
Returns this
- target: number
entries
Returns an iterable of key, value pairs for every entry in the array
Returns ArrayIterator<[number, ColorStop]>
every
- every<S extends ColorStop>(
predicate: (
value: ColorStop,
index: number,
array: ColorStop[],
) => value is S,
thisArg?: any,
): this is S[]Determines whether all the members of an array satisfy the specified test.
Type Parameters
- S extends ColorStop
Parameters
- predicate: (value: ColorStop, index: number, array: ColorStop[]) => value is S
A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.
OptionalthisArg: anyAn object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.
Returns this is S[]
- every(
predicate: (
value: ColorStop,
index: number,
array: ColorStop[],
) => unknown,
thisArg?: any,
): booleanDetermines whether all the members of an array satisfy the specified test.
Parameters
- predicate: (value: ColorStop, index: number, array: ColorStop[]) => unknown
A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.
OptionalthisArg: anyAn object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.
Returns boolean
- predicate: (value: ColorStop, index: number, array: ColorStop[]) => unknown
fill
Changes all array elements from
starttoendindex to a staticvalueand returns the modified arrayParameters
- value: ColorStop
value to fill array section with
Optionalstart: numberindex to start filling the array at. If start is negative, it is treated as length+start where length is the length of the array.
Optionalend: numberindex to stop filling the array at. If end is negative, it is treated as length+end.
Returns this
- value: ColorStop
filter
- filter<S extends ColorStop>(
predicate: (
value: ColorStop,
index: number,
array: ColorStop[],
) => value is S,
thisArg?: any,
): S[]Returns the elements of an array that meet the condition specified in a callback function.
Type Parameters
- S extends ColorStop
Parameters
- predicate: (value: ColorStop, index: number, array: ColorStop[]) => value is S
A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.
OptionalthisArg: anyAn object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.
Returns S[]
- filter(
predicate: (
value: ColorStop,
index: number,
array: ColorStop[],
) => unknown,
thisArg?: any,
): ColorStop[]Returns the elements of an array that meet the condition specified in a callback function.
Parameters
- predicate: (value: ColorStop, index: number, array: ColorStop[]) => unknown
A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.
OptionalthisArg: anyAn object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.
Returns ColorStop[]
- predicate: (value: ColorStop, index: number, array: ColorStop[]) => unknown
find
- find<S extends ColorStop>(
predicate: (
value: ColorStop,
index: number,
obj: ColorStop[],
) => value is S,
thisArg?: any,
): S | undefinedReturns the value of the first element in the array where predicate is true, and undefined otherwise.
Type Parameters
- S extends ColorStop
Parameters
- predicate: (value: ColorStop, index: number, obj: ColorStop[]) => value is S
find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined.
OptionalthisArg: anyIf provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.
Returns S | undefined
findIndex
- findIndex(
predicate: (
value: ColorStop,
index: number,
obj: ColorStop[],
) => unknown,
thisArg?: any,
): numberReturns the index of the first element in the array where predicate is true, and -1 otherwise.
Parameters
- predicate: (value: ColorStop, index: number, obj: ColorStop[]) => unknown
find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1.
OptionalthisArg: anyIf provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.
Returns number
- predicate: (value: ColorStop, index: number, obj: ColorStop[]) => unknown
flat
flatMap
- flatMap<U, This = undefined>(
callback: (
this: This,
value: ColorStop,
index: number,
array: ColorStop[],
) => U | readonly U[],
thisArg?: This,
): U[]Calls a defined callback function on each element of an array. Then, flattens the result into a new array. This is identical to a map followed by flat with depth 1.
Type Parameters
- U
- This = undefined
Parameters
- callback: (
this: This,
value: ColorStop,
index: number,
array: ColorStop[],
) => U | readonly U[]A function that accepts up to three arguments. The flatMap method calls the callback function one time for each element in the array.
OptionalthisArg: ThisAn object to which the this keyword can refer in the callback function. If thisArg is omitted, undefined is used as the this value.
Returns U[]
forEach
- forEach(
callbackfn: (
value: ColorStop,
index: number,
array: ColorStop[],
) => void,
thisArg?: any,
): voidPerforms the specified action for each element in an array.
Parameters
- callbackfn: (value: ColorStop, index: number, array: ColorStop[]) => void
A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
OptionalthisArg: anyAn object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
Returns void
- callbackfn: (value: ColorStop, index: number, array: ColorStop[]) => void
getBounds
Returns { max: number; min: number }
getCanvasStrip
getColor
Parameters
- value: number
Optionaloptions: { smooth?: boolean }
Returns RgbaColor
getRawColorStops
Returns ColorStop[]
includes
Determines whether an array includes a certain element, returning true or false as appropriate.
Parameters
- searchElement: ColorStop
The element to search for.
OptionalfromIndex: numberThe position in this array at which to begin searching for searchElement.
Returns boolean
- searchElement: ColorStop
indexOf
Returns the index of the first occurrence of a value in an array, or -1 if it is not present.
Parameters
- searchElement: ColorStop
The value to locate in the array.
OptionalfromIndex: numberThe array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.
Returns number
- searchElement: ColorStop
join
Adds all the elements of an array into a string, separated by the specified separator string.
Parameters
Optionalseparator: stringA string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.
Returns string
keys
Returns an iterable of keys in the array
Returns ArrayIterator<number>
lastIndexOf
Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present.
Parameters
- searchElement: ColorStop
The value to locate in the array.
OptionalfromIndex: numberThe array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array.
Returns number
- searchElement: ColorStop
map
- map<U>(
callbackfn: (value: ColorStop, index: number, array: ColorStop[]) => U,
thisArg?: any,
): U[]Calls a defined callback function on each element of an array, and returns an array that contains the results.
Type Parameters
- U
Parameters
- callbackfn: (value: ColorStop, index: number, array: ColorStop[]) => U
A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.
OptionalthisArg: anyAn object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
Returns U[]
pop
Removes the last element from an array and returns it. If the array is empty, undefined is returned and the array is not modified.
Returns ColorStop | undefined
push
Appends new elements to the end of an array, and returns the new length of the array.
Parameters
- ...items: ColorStop[]
New elements to add to the array.
Returns number
- ...items: ColorStop[]
reduce
- reduce(
callbackfn: (
previousValue: ColorStop,
currentValue: ColorStop,
currentIndex: number,
array: ColorStop[],
) => ColorStop,
): ColorStopCalls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
Parameters
Returns ColorStop
- reduce<U>(
callbackfn: (
previousValue: U,
currentValue: ColorStop,
currentIndex: number,
array: ColorStop[],
) => U,
initialValue: U,
): UCalls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
Type Parameters
- U
Parameters
- callbackfn: (
previousValue: U,
currentValue: ColorStop,
currentIndex: number,
array: ColorStop[],
) => UA function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
- initialValue: U
If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
Returns U
reduceRight
- reduceRight(
callbackfn: (
previousValue: ColorStop,
currentValue: ColorStop,
currentIndex: number,
array: ColorStop[],
) => ColorStop,
): ColorStopCalls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
Parameters
Returns ColorStop
- reduceRight<U>(
callbackfn: (
previousValue: U,
currentValue: ColorStop,
currentIndex: number,
array: ColorStop[],
) => U,
initialValue: U,
): UCalls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
Type Parameters
- U
Parameters
- callbackfn: (
previousValue: U,
currentValue: ColorStop,
currentIndex: number,
array: ColorStop[],
) => UA function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
- initialValue: U
If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
Returns U
reverse
Reverses the elements in an array in place. This method mutates the array and returns a reference to the same array.
Parameters
Optionaloptions: { clone?: boolean }
Returns ColorRamp
scale
Parameters
- min: number
- max: number
Optionaloptions: { clone?: boolean }
Returns ColorRamp
setStops
shift
Removes the first element from an array and returns it. If the array is empty, undefined is returned and the array is not modified.
Returns ColorStop | undefined
slice
Returns a copy of a section of an array. For both start and end, a negative index can be used to indicate an offset from the end of the array. For example, -2 refers to the second to last element of the array.
Parameters
Optionalstart: numberThe beginning index of the specified portion of the array. If start is undefined, then the slice begins at index 0.
Optionalend: numberThe end index of the specified portion of the array. This is exclusive of the element at the index 'end'. If end is undefined, then the slice extends to the end of the array.
Returns ColorStop[]
some
- some(
predicate: (
value: ColorStop,
index: number,
array: ColorStop[],
) => unknown,
thisArg?: any,
): booleanDetermines whether the specified callback function returns true for any element of an array.
Parameters
- predicate: (value: ColorStop, index: number, array: ColorStop[]) => unknown
A function that accepts up to three arguments. The some method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array.
OptionalthisArg: anyAn object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.
Returns boolean
- predicate: (value: ColorStop, index: number, array: ColorStop[]) => unknown
sort
Sorts an array in place. This method mutates the array and returns a reference to the same array.
Parameters
OptionalcompareFn: (a: ColorStop, b: ColorStop) => numberFunction used to determine the order of the elements. It is expected to return a negative value if the first argument is less than the second argument, zero if they're equal, and a positive value otherwise. If omitted, the elements are sorted in ascending, UTF-16 code unit order.
[11,2,22,1].sort((a, b) => a - b)
Returns this
splice
Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
Parameters
- start: number
The zero-based location in the array from which to start removing elements.
OptionaldeleteCount: numberThe number of elements to remove. Omitting this argument will remove all elements from the start paramater location to end of the array. If value of this argument is either a negative number, zero, undefined, or a type that cannot be converted to an integer, the function will evaluate the argument as zero and not remove any elements.
Returns ColorStop[]
An array containing the elements that were deleted.
- start: number
Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
Parameters
- start: number
The zero-based location in the array from which to start removing elements.
- deleteCount: number
The number of elements to remove. If value of this argument is either a negative number, zero, undefined, or a type that cannot be converted to an integer, the function will evaluate the argument as zero and not remove any elements.
- ...items: ColorStop[]
Elements to insert into the array in place of the deleted elements.
Returns ColorStop[]
An array containing the elements that were deleted.
- start: number
toLocaleString
Returns a string representation of an array. The elements are converted to string using their toLocaleString methods.
Returns string
- toLocaleString(
locales: string | string[],
options?: NumberFormatOptions & DateTimeFormatOptions,
): stringParameters
- locales: string | string[]
Optionaloptions: NumberFormatOptions & DateTimeFormatOptions
Returns string
toString
Returns a string representation of an array.
Returns string
unshift
Inserts new elements at the start of an array, and returns the new length of the array.
Parameters
- ...items: ColorStop[]
Elements to insert at the start of the array.
Returns number
- ...items: ColorStop[]
values
Returns an iterable of values in the array
Returns ArrayIterator<ColorStop>
Staticfrom
StaticfromArrayDefinition
Converts a array-definition color ramp definition into a usable ColorRamp instance. Note: units are not converted and may need to to be converted beforehand (eg. kelvin to centigrade)
Parameters
- cr: ArrayColorRamp
Returns ColorRamp
StaticisArray
Parameters
- arg: any
Returns arg is any[]
Is an object whose properties have the value 'true' when they will be absent when used in a 'with' statement.