require(["esri/smartMapping/symbology/pieChart"], (pieChartSchemes) => { /* code goes here */ });
import * as pieChartSchemes from "@arcgis/core/smartMapping/symbology/pieChart.js";
esri/smartMapping/symbology/pieChart
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
cloneScheme(scheme){PieChartScheme}
-
Clones a pie chart scheme object.
Parameterscheme PieChartSchemeThe pie chart scheme object to clone.
ReturnsType 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
getSchemeByName(params){PieChartScheme}
-
Returns a pie chart scheme with the given name.
ParametersSpecificationparams ObjectSee the table below for details of each parameter that may be passed to this function.
Specificationname StringThe name of the scheme to retrieve.
optional The basemap to pair with the visualization. This value indicates the best colors for visualizing charts with the given basemap.
basemapTheme StringoptionalIf 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
ordark
.Possible Values:"light"|"dark"
geometryType StringThe geometry type of the features to visualize.
Possible Values:"point"|"polygon"
numColors NumberThe number of values to include in the pie chart.
ReturnsType 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
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.ParametersSpecificationparams ObjectSee the table below for details of each parameter that may be passed to this function.
Specificationoptional 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 StringoptionalIf 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
ordark
.Possible Values:"light"|"dark"
geometryType StringThe geometry type of the features to visualize.
Possible Values:"point"|"polygon"
numColors NumberThe number of unique values to include in the pie chart visualization.
ReturnsType 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
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.
ParametersSpecificationparams ObjectSee the table below for details of each parameter that may be passed to this function.
Specificationoptional 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
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
optional The basemap to pair with the visualization. This value indicates the best colors for visualizing charts with the given basemap.
basemapTheme StringoptionalIf 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
ordark
.Possible Values:"light"|"dark"
geometryType StringThe geometry type of the features to visualize.
Possible Values:"point"|"polygon"
numColors NumberThe number of categories to include in the pie chart visualization.
ReturnsType Description PieChartScheme[] Returns an array of pie chart schemes either including or excluding the provided tags. Examplelet schemes = pieChartSchemes.getSchemesByTag({ includedTags: [ "types", "reds" ], basemap: map.basemap, geometryType: featureLayer.geometryType });
-
Returns metadata for the available themes. If a basemap is provided, returns themes that work best with the given basemap.
Parameteroptional The Esri basemap string or object that will be used with the returned theme(s).
Returns
Type Definitions
-
Properties defining the colors and schemes used to visualize pie charts.
- Properties
-
name String
The unique name of the color scheme.
Tags associated with the color scheme.
The colors used to visualize pie slices in the chart.
colorForOthersCategory ColorThe color of the "others" category.
outline ObjectProperties for defining the outline of the pie chart.
sizeScheme SizeSchemeThe scheme defining the size visual variable used to vary chart size per feature.
The default size of the pie charts in points or pixels.
-
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 StringThe ID of the basemap associated with the given schemes.
basemapTheme StringIndicates whether the average basemap color is
light
ordark
.