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

Object containing helper methods for getting optimal symbol schemes used to create predominance visualizations. The getSchemes() returns color schemes best suited to the given basemap for this visualization style.

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 symbol properties for predominance-based data-driven visualizations in a Layer. The basemap parameter determines the color of the symbols used to visualize each feature. The geometryType determines which type of symbol to return.

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

The function parameters.

Returns
PredominanceSchemes | null | undefined

Returns an object containing the optimal type scheme to use for the given basemap; it also contains secondary schemes.

Example
// gets the primary scheme for the features of the given geometry type and basemap
const schemes = predominanceSchemes.getSchemes({
basemap: map.basemap,
geometryType: featureLayer.geometryType
});
// the best default scheme for the layer and basemap
const primaryScheme = schemes.primaryScheme;

getSchemeByName

Function
Since
ArcGIS Maps SDK for JavaScript 4.12

Returns a predominance scheme with the provided name.

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

The function parameters.

Returns
PredominanceScheme | null | undefined

Returns the predominance scheme with the given name.

Example
// Returns the Flower Field scheme
let flowerFieldScheme = colorSchemes.getSchemeByName({
name: "Flower Field",
basemap: map.basemap,
geometryType: featureLayer.geometryType
});

getSchemesByTag

Function
Since
ArcGIS Maps SDK for JavaScript 4.12

Returns an array of predominance schemes with the provided tags. These schemes define symbol properties for predominance visualizations in any layer that can be rendered with a Renderer.

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

The function parameters.

Returns
PredominanceScheme[]

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

Example
let schemes = predominanceSchemes.getSchemesByTag({
includedTags: [ "types" ],
basemap: map.basemap,
geometryType: featureLayer.geometryType
});

cloneScheme

Function

Clones a predominance scheme object.

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

The predominance scheme object to clone.

Returns
PredominanceScheme | null | undefined

Returns a clone of the given predominance scheme object.

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

Type definitions

GetSchemesParameters

Type definition

numColors

Property
Type
number | undefined

The number of unique values to include in the predominance visualization.

basemap

Property
Type
Basemap | string | null | undefined

The Esri basemap to pair with the visualization. This value indicates the best symbol 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.

geometryType

Property
Type
"point" | "multipoint" | "polyline" | "polygon" | "mesh" | "multipatch" | null

The geometry type of the features to visualize.

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.

theme

Property
Type
"default" | null | undefined

Determines which set of primary and secondary color schemes to return.

Default value
default

worldScale

Property
Type
boolean | null | undefined

Indicates if the size units of the scheme will be in meters. This should be true when the scheme is intended for 3D volumetric symbology. A view must be provided if this property is set to true.

view

Property
Type
SceneView | null | undefined

The SceneView instance in which the scheme will be used. This property is only applicable when the scheme will be used in conjunction with 3D symbols.

GetSchemesByNameParameters

Type definition

name

Property
Type
string

The name of the scheme to retrieve.

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