This class defines a standard way to customize the colors displayed in a heat map by associating custom colors with the normalized "heat" values.
It associates colors with "heat" values via the stops property.
This property is a map, where the keys are numbers ranging from 0 to 1, inclusive,
and the values are colors associated with these numeric values.
The colors are represented using CSS syntax, that is hexadecimal notation ("#RGB" or "#RRGGBB") or
rgb(a) notation ("rgba(R, G, B, A)"), etc.
The range [0 .. 1] stands for the normalized "heat" value.
| Name | Type | Description |
|---|---|---|
stops |
Object.<string> |
An object defining the color stops |
opt_interpolate |
boolean |
optional
A value indicating whether interpolation
is to be used to display smooth color transitions in the heat map
( |
Throws:
-
If color stops are not specified, if the object is empty, or the object uses incorrect syntax.
Example
var colors = new H.data.heatmap.Colors({
'0': 'rgba(255, 0, 0, 0.5)', // half-transparent red
'0.5': 'rgba(255, 255, 0, 0.5)', // half-transparent yellow
'1': 'rgba(255, 255, 255, 0.5)' // half-transparent white
},
true // interpolate between the stops to create a smooth color gradient
);
Members
-
H.data.heatmap.Colors.DEFAULT H.data.heatmap.Colors staticconstantnon-null
-
This static member defines the default heat map colors. It uses color interpolation and has the following color stops:
Example
{ '0': '#008', // dark blue '0.2': '#0b0', // medium green '0.5': '#ff0', // yellow '0.7': '#f00' // red }