import { getSchemes, getSchemeByName, getSchemesByTag, cloneScheme } from "@arcgis/core/smartMapping/symbology/dotDensity.js";const { getSchemes, getSchemeByName, getSchemesByTag, cloneScheme } = await $arcgis.import("@arcgis/core/smartMapping/symbology/dotDensity.js");- Since
- ArcGIS Maps SDK for JavaScript 4.12
Object containing helper methods for getting optimal symbol schemes used to create dot density visualizations. The getSchemes() returns color schemes best suited to the given basemap for this visualization style.
Functions
getSchemes
Returns a primary scheme and secondary schemes defining symbol properties for dot density-based
data-driven visualizations in a Layer. The basemap parameter determines the color of the
dots used to visualize each attribute. The geometryType determines which type of symbol to return.
- Signature
-
getSchemes (params: GetSchemesParameters): DotDensitySchemes | null | undefined
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| params | The function parameters. | |
- Returns
- DotDensitySchemes | 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 = dotDensitySchemes.getSchemes({ basemap: map.basemap, geometryType: featureLayer.geometryType});
// the best default scheme for the layer and basemapconst primaryScheme = schemes.primaryScheme; getSchemeByName
Returns a dot density scheme with the provided name.
- Signature
-
getSchemeByName (params: GetSchemesByNameParameters): DotDensityScheme | null | undefined
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| params | The function parameters. | |
- Returns
- DotDensityScheme | null | undefined
Returns the dot density scheme with the given name.
Example
// Returns the Galaxy Berries schemelet galaxyBerriesScheme = dotDensitySchemes.getSchemeByName({ basemap: map.basemap, numColors: 3, name: "Galaxy Berries"}); getSchemesByTag
Returns an array of dot density schemes with the provided tags. These schemes define symbol properties for dot density visualizations in any layer that can be rendered with a DotDensityRenderer.
- Signature
-
getSchemesByTag (params: GetSchemesByTagParameters): DotDensityScheme[]
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| params | The function parameters. | |
- Returns
- DotDensityScheme[]
Returns an array of dot density schemes either including or excluding the provided tags.
Example
// Returns all the red dot density schemeslet schemes = dotDensitySchemes.getSchemesByTag({ basemap: map.basemap, numColors: 2, includedTags: [ "reds", "dot-density" ]}); cloneScheme
Clones a dot density scheme object.
- Signature
-
cloneScheme (scheme: DotDensityScheme | null | undefined): DotDensityScheme | null | undefined
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| scheme | The dot density scheme object to clone. | |
- Returns
- DotDensityScheme | null | undefined
Returns a clone of the given dot density scheme object.
Example
// clones the primary scheme returned from the getSchemes() methodconst dotDensityScheme = 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.
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