require(["esri/smartMapping/statistics/predominantCategories"], (predominantCategories) => { /* code goes here */ });
import predominantCategories from "@arcgis/core/smartMapping/statistics/predominantCategories.js";
esri/smartMapping/statistics/predominantCategories
Function for generating category statistics for a predominance renderer.
Method Overview
Name | Return Type | Summary | Function |
---|---|---|---|
Promise<PredominantCategoriesResult> | Determines predominant categories for a layer based on a given set of competing numeric fields and returns the number of features belonging to each category. | predominantCategories |
Method Details
-
predominantCategories
predominantCategories(params){Promise<PredominantCategoriesResult>}
-
Determines predominant categories for a layer based on a given set of competing numeric fields and returns the number of features belonging to each category.
ParametersSpecificationparams ObjectSee the table below for details of each parameter.
Specificationlayer FeatureLayer|SceneLayer|CSVLayer|GeoJSONLayer|WFSLayer|OGCFeatureLayer|StreamLayer|OrientedImageryLayer|CatalogFootprintLayer|KnowledgeGraphSublayer|SubtypeGroupLayer|SubtypeSublayerThe layer from which to generate predominant categories for the given set of
fields
.An array of numeric fields from which to determine predominant categories. The fields must all be number fields and they must be competing or complementary (e.g. population totals by language spoken at home, or harvested acres by crop type, or the results of an election by candidate or party).
forBinning BooleanoptionalIndicates whether the generated statistics are for a binning or clustering visualization. If
true
, then the input field(s) in this method should refer to aggregate fields defined in thefeatureReduction
property of the layer.optional The view in which features will be rendered.
signal AbortSignaloptionalAllows for cancelable requests. If canceled, the promise will be rejected with an error named
AbortError
. See also AbortController.ReturnsType Description Promise<PredominantCategoriesResult> Returns a promise that resolves to PredominantCategoriesResult. ExamplepredominantCategories({ layer: featureLayer, fields: [ "corn_acres", "cotton_acres", "wheat_acres", "soybeans_acres", "vegetables_acres" ], view: mapView }).then(function(stats){ console.log(stats.predominantCategoryInfos); });
Type Definitions
-
The statistics returned from the predominantCategories() function.
- Properties
-
An array of objects describing the count of each predominant category.