pieChart

AMD: require(["esri/smartMapping/symbology/pieChart"], (pieChartSchemes) => { /* code goes here */ });
ESM: import * as pieChartSchemes from "@arcgis/core/smartMapping/symbology/pieChart.js";
Object: esri/smartMapping/symbology/pieChart
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.

Method Overview

Name Return Type Summary Object

Clones a pie chart scheme object.

pieChart

Returns a pie chart scheme with the given name.

pieChart

Returns a primary scheme and secondary schemes defining properties for pie chart visualizations.

pieChart

Returns an array of pie chart schemes with the provided tags.

pieChart

Returns metadata for the available themes.

pieChart

Method Details

cloneScheme

Method
cloneScheme(scheme){PieChartScheme}

Clones a pie chart scheme object.

Parameter

The pie chart scheme object to clone.

Returns
Type Description
PieChartScheme Returns a clone of the given pie chart scheme object.
Example
// clones the primary scheme returned from the getSchemes() method
const pieChartScheme = primaryScheme.clone();

getSchemeByName

Method
getSchemeByName(params){PieChartScheme}

Returns a pie chart scheme with the given name.

Parameters
Specification
params Object

See the table below for details of each parameter that may be passed to this function.

Specification
name String

The name of the scheme to retrieve.

basemap String|Basemap
optional

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

basemapTheme String
optional

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.

Possible Values:"light"|"dark"

geometryType String

The geometry type of the features to visualize.

Possible Values:"point"|"polygon"

numColors Number

The number of values to include in the pie chart.

Returns
Type Description
PieChartScheme Returns the pie chart scheme with the given name.
Example
// Returns the Flower Field scheme
let flowerFieldScheme = pieChartSchemes.getSchemeByName({
  name: "Flower Field",
  basemap: map.basemap,
  geometryType: featureLayer.geometryType
});

getSchemes

Method
getSchemes(params){PieChartSchemes}

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.

Parameters
Specification
params Object

See the table below for details of each parameter that may be passed to this function.

Specification
basemap String|Basemap
optional

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 String
optional

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.

Possible Values:"light"|"dark"

geometryType String

The geometry type of the features to visualize.

Possible Values:"point"|"polygon"

numColors Number

The number of unique values to include in the pie chart visualization.

Returns
Type Description
PieChartSchemes 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 basemap
const { primaryScheme, secondarySchemes } = pieChartSchemes.getSchemes({
  basemap: map.basemap,
  geometryType: featureLayer.geometryType
});

// primaryScheme is the suggested default scheme for the layer and basemap

getSchemesByTag

Method
getSchemesByTag(params){PieChartScheme[]}

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.

Parameters
Specification
params Object

See the table below for details of each parameter that may be passed to this function.

Specification
includedTags String[]
optional

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 String[]
optional

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 String|Basemap
optional

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

basemapTheme String
optional

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.

Possible Values:"light"|"dark"

geometryType String

The geometry type of the features to visualize.

Possible Values:"point"|"polygon"

numColors Number

The number of categories to include in the pie chart visualization.

Returns
Type Description
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
});

getThemes

Method
getThemes(basemap){Theme[]}

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

Parameter
basemap String|Basemap
optional

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

Returns
Type Description
Theme[] Returns an object containing information about the available themes for the given basemap.

Type Definitions

PieChartScheme

Type Definition
PieChartScheme

Properties defining the colors and schemes used to visualize pie charts.

Properties
name String

The unique name of the color scheme.

tags String[]

Tags associated with the color scheme.

colors Color[]

The colors used to visualize pie slices in the chart.

colorForOthersCategory Color

The color of the "others" category.

outline Object

Properties for defining the outline of the pie chart.

Specification
color Color

The outline color of the pie chart.

width Number|String

The width of the outline in points.

sizeScheme SizeScheme

The scheme defining the size visual variable used to vary chart size per feature.

size Number|String

The default size of the pie charts in points or pixels.

PieChartSchemes

Type Definition
PieChartSchemes

The return object of the getSchemes() method.

Properties
primaryScheme PieChartScheme

The suggest default chart scheme based on the given basemap.

secondarySchemes PieChartScheme[]

Additional chart schemes that may be used to visualize data overlaid on the given basemap.

basemapId String

The ID of the basemap associated with the given schemes.

basemapTheme String

Indicates whether the average basemap color is light or dark.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.