Skip to content
import { getThemes, getSchemes, getSchemeByName, getSchemesByTag, cloneScheme } from "@arcgis/core/smartMapping/symbology/heatmap.js";
Since
ArcGIS Maps SDK for JavaScript 4.11

Object containing helper methods for generating optimal colors for heatmap visualizations. The getSchemes() method is used to get the heatmap color schemes best suited to the given basemap.

Functions

getThemes

Function

Returns metadata for the available themes. If a basemap is provided, returns themes that work best with the given basemap.

Signature
getThemes (basemap?: Basemap | string): Theme[]
Parameters
ParameterTypeDescriptionRequired
basemap

The Esri basemap string or object that will be used with the returned theme(s).

Returns
Theme[]

Returns an object containing information about the available themes for the given basemap.

getSchemes

Function

Returns a primary scheme and secondary schemes defining properties for heatmap visualizations in a point Layer. The basemap parameter determines the color schemes of the heatmap.

Signature
getSchemes (params: GetSchemesParameters): HeatmapSchemes | null | undefined
Parameters
ParameterTypeDescriptionRequired
params

The function parameters.

Returns
HeatmapSchemes | null | undefined

Returns an object containing the optimal heatmap scheme to use for the given basemap and secondary schemes that may also be used.

Example
// gets the primary scheme for the basemap
let schemes = heatmapSchemes.getSchemes({
basemap: map.basemap
});
// the best default scheme for the layer, basemap, and theme
let primaryScheme = schemes.primaryScheme;

getSchemeByName

Function
Since
ArcGIS Maps SDK for JavaScript 4.12

Returns a heatmap scheme with the provided name.

Signature
getSchemeByName (params: GetSchemesByNameParameters): HeatmapScheme | null | undefined
Parameters
ParameterTypeDescriptionRequired
params

The function parameters.

Returns
HeatmapScheme | null | undefined

Returns the heatmap scheme with the given name.

Example
// Returns the Heatmap 4 scheme
let heatmapScheme = heatmapSchemes.getSchemeByName({
basemap: map.basemap,
name: "Heatmap 4"
});

getSchemesByTag

Function
Since
ArcGIS Maps SDK for JavaScript 4.12

Returns an array of heatmap schemes with the provided tags. These schemes define color stop properties for any layer that can be rendered with a HeatmapRenderer.

Signature
getSchemesByTag (params: GetSchemesByTagParameters): HeatmapScheme[]
Parameters
ParameterTypeDescriptionRequired
params

The function parameters.

Returns
HeatmapScheme[]

Returns an array of heatmap schemes either including or excluding the provided tags.

Example
// Returns all the heatmap schemes that look good in grayscale
let grayscaleSchemes = heatmapSchemes.getSchemesByTag({
basemap: map.basemap,
includedTags: [ "heatmap", "grayscale" ]
});

cloneScheme

Function

Clones a heatmap scheme object.

Signature
cloneScheme (scheme: HeatmapScheme | null | undefined): HeatmapScheme | null | undefined
Parameters
ParameterTypeDescriptionRequired
scheme

The heatmap scheme object to clone.

Returns
HeatmapScheme | null | undefined

A clone of the given heatmap scheme object.

Example
// clones the primary scheme returned from the getSchemes() method
let heatmapScheme = primaryScheme.clone();

Type definitions

GetSchemesParameters

Type definition

basemap

Property
Type
Basemap | string | null | undefined

The Esri basemap to pair with the visualization. This value indicates the best colors for visualizing features against the given basemap. If you have a non-Esri basemap (e.g. a VectorTileLayer basemap with a custom style) or no basemap at all, then use the basemapTheme parameter instead of this parameter.

basemapTheme

Property
Type
BasemapTheme | null | undefined

If you have a non-Esri basemap (e.g. a VectorTileLayer basemap with a custom style) or no basemap at all, use this parameter to indicate whether the background of the visualization is light or dark.

GetSchemesByNameParameters

Type definition

name

Property
Type
string

The name of the scheme to retrieve.

basemap

Property
Type
Basemap | string | null | undefined

The basemap to pair with the visualization. This value indicates the best colors for visualizing features against the given basemap.

basemapTheme

Property
Type
BasemapTheme | null | undefined

If you have a non-Esri basemap (e.g. a VectorTileLayer basemap with a custom style) or no basemap at all, use this parameter to indicate whether the background of the visualization is light or dark.

GetSchemesByTagParameters

Type definition

includedTags

Property
Type
string[] | null | undefined

When provided, only schemes containing all the matching tags will be returned.

Known Tags: light | dark | reds | yellows | oranges | greens | blues | purples | pinks | browns | grays | bright | subdued | deuteranopia | protanopia | tritanopia | grayscale | types | dot-density

excludedTags

Property
Type
string[] | null | undefined

When provided, only schemes missing all the provided tags will be returned.

Known Tags: light | dark | reds | yellows | oranges | greens | blues | purples | pinks | browns | grays | bright | subdued | deuteranopia | protanopia | tritanopia | grayscale | types | dot-density

basemap

Property
Type
Basemap | string

The basemap to pair with the visualization. This value indicates the best symbol colors for visualizing features against the given basemap.