predominantCategories

require(["esri/renderers/smartMapping/statistics/predominantCategories"], function(predominantCategories) { /* code goes here */ });
Function: esri/renderers/smartMapping/statistics/predominantCategories
Since: ArcGIS API for JavaScript 4.13

Function for generating category statistics for a predominance renderer.

Method Overview

NameReturn TypeSummaryFunction
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.

more details
more detailspredominantCategories

Method Details

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.

Parameters:
Specification:
params Object

See the table below for details of each parameter.

Specification:

The layer from which to generate predominant categories for the given set of fields.

fields String[]

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).

optional

The view in which features will be rendered.

Returns:
TypeDescription
Promise<PredominantCategoriesResult>Returns a promise that resolves to PredominantCategoriesResult.
Example:
predominantCategories({
  layer: featureLayer,
  fields: [ "corn_acres", "cotton_acres", "wheat_acres", "soybeans_acres", "vegetables_acres" ],
  view: mapView
}).then(function(stats){
  console.log(stats.predominantCategoryInfos);
});

Type Definitions

PredominantCategoriesResult

The statistics returned from the predominantCategories() function.

Properties:
predominantCategoryInfos Object[]

An array of objects describing the count of each predominant category.

Specification:

The value or category referenced in a predominance visualization. This is typically a field name.

count Number

The number of features belonging to the predominant category.

label String
optional

The label describing the predominant category, or field name.

API Reference search results

NameTypeModule
Loading...