import { getThemes, getSchemes, getSchemeByName, getSchemesByTag, cloneScheme } from "@arcgis/core/smartMapping/symbology/predominance.js";const { getThemes, getSchemes, getSchemeByName, getSchemesByTag, cloneScheme } = await $arcgis.import("@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
| Name | Return Type | Object |
|---|---|---|
Theme[] | | |
| | ||
| | ||
| | ||
| | ||
| | |
| | |
| |
getThemes
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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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
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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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 basemapconst schemes = predominanceSchemes.getSchemes({ basemap: map.basemap, geometryType: featureLayer.geometryType});
// the best default scheme for the layer and basemapconst primaryScheme = schemes.primaryScheme; getSchemeByName
- Since
- ArcGIS Maps SDK for JavaScript 4.12
Returns a predominance scheme with the provided name.
- Signature
-
getSchemeByName (params: GetSchemesByNameParameters): PredominanceScheme | null | undefined
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| params | The function parameters. | |
- Returns
- PredominanceScheme | null | undefined
Returns the predominance scheme with the given name.
Example
// Returns the Flower Field schemelet flowerFieldScheme = colorSchemes.getSchemeByName({ name: "Flower Field", basemap: map.basemap, geometryType: featureLayer.geometryType}); getSchemesByTag
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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
Clones a predominance scheme object.
- Signature
-
cloneScheme (scheme: PredominanceScheme | null | undefined): PredominanceScheme | null | undefined
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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() methodconst predominanceScheme = primaryScheme.clone();Type definitions
GetSchemesParameters
basemap
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
- Type
- "point" | "multipoint" | "polyline" | "polygon" | "mesh" | "multipatch" | null
The geometry type of the features to visualize.
basemapTheme
- 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
- Supertypes
- GetSchemesParameters