import { getThemes, getSchemes, getSchemeByName, getSchemesByTag, cloneScheme } from "@arcgis/core/smartMapping/symbology/pieChart.js";const { getThemes, getSchemes, getSchemeByName, getSchemesByTag, cloneScheme } = await $arcgis.import("@arcgis/core/smartMapping/symbology/pieChart.js");- Since
- ArcGIS Maps SDK for JavaScript 4.24
Object containing helper methods for getting optimal color schemes used to create pie chart visualizations. The getSchemes() returns color schemes best suited to the given basemap for this visualization style.
Functions
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 properties for pie chart visualizations.
The basemap parameter determines the colors
used to visualize each pie slice.
- Signature
-
getSchemes (params: GetSchemesParameters): PieChartSchemes | null | undefined
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| params | The function parameters. | |
- Returns
- PieChartSchemes | null | undefined
Returns an object containing the optimal pie chart 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 { primaryScheme, secondarySchemes } = pieChartSchemes.getSchemes({ basemap: map.basemap, geometryType: featureLayer.geometryType});
// primaryScheme is the suggested default scheme for the layer and basemap getSchemeByName
Returns a pie chart scheme with the given name.
- Signature
-
getSchemeByName (params: GetSchemesByNameParameters): PieChartScheme | null | undefined
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| params | The function parameters. | |
- Returns
- PieChartScheme | null | undefined
Returns the pie chart scheme with the given name.
Example
// Returns the Flower Field schemelet flowerFieldScheme = pieChartSchemes.getSchemeByName({ name: "Flower Field", basemap: map.basemap, geometryType: featureLayer.geometryType}); getSchemesByTag
Returns an array of pie chart schemes with the provided tags. These schemes define properties for pie charts in any layer that can be rendered with a PieChartRenderer.
- Signature
-
getSchemesByTag (params: GetSchemesByTagParameters): PieChartScheme[]
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| params | The function parameters. | |
- Returns
- PieChartScheme[]
Returns an array of pie chart schemes either including or excluding the provided tags.
Example
let schemes = pieChartSchemes.getSchemesByTag({ includedTags: [ "types", "reds" ], basemap: map.basemap, geometryType: featureLayer.geometryType}); cloneScheme
Clones a pie chart scheme object.
- Signature
-
cloneScheme (scheme: PieChartScheme | null | undefined): PieChartScheme | null | undefined
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| scheme | The pie chart scheme object to clone. | |
- Returns
- PieChartScheme | null | undefined
Returns a clone of the given pie chart scheme object.
Example
// clones the primary scheme returned from the getSchemes() methodconst pieChartScheme = primaryScheme.clone();Type definitions
GetSchemesParameters
numColors
- Type
- number
The number of unique values to include in the pie chart visualization.
basemap
The Esri basemap to pair with the visualization. This
value indicates the best color schemes for visualizing charts 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.
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