H.data.heatmap.Colors
Class Summary
This class defines a standard way to customize the colors displayed in a heat map by associating custom colors with the normalized "heat" values.
[ For full details, see the Class Details ]
Property Summary
Properties |
---|
This static member defines the default heat map colors. It uses color interpolation and has the following color stops: |
Class Description
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.
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
);
Constructor Details
H.data.heatmap.Colors(stops, opt_interpolate)
- Parameters:
-
stops
: -
{Object<string, 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 (
true
) or whether the heat map is to be posterized (false
), the default isfalse
.
- Throws:
-
{H.lang.InvalidArgumentError}
- If color stops are not specified, if the object is empty, or the object uses incorrect syntax.
Property Details
static DEFAULT: {H.data.heatmap.Colors}
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
}