• esri/smartMapping
    • statistics/support

predominanceUtils

AMD: require(["esri/smartMapping/statistics/support/predominanceUtils"], (predominanceUtils) => { /* code goes here */ });
ESM: import * as predominanceUtils from "@arcgis/core/smartMapping/statistics/support/predominanceUtils";
Object: esri/smartMapping/statistics/support/predominanceUtils
Since: ArcGIS API for JavaScript 4.23

Provides utility functions for generating Arcade and SQL expressions intended for use in an predominance renderer.

Method Overview

Name Return Type Summary Object
PredominantExpressionsmore details

Returns Arcade and SQL expressions used for visualizing the predominant category (or field) among a set of competing fields.

more detailspredominanceUtils

Method Details

getPredominanceExpressions(layer, fieldNames){PredominantExpressions}

Returns Arcade and SQL expressions used for visualizing the predominant category (or field) among a set of competing fields.

Parameters:

The layer from which to generate the Arcade and SQL expressions for querying predominance statistics.

fieldNames String[]

An array of numeric field names for which to create the Arcade and SQL expressions used to build the predominance renderer.

Returns:
Type Description
PredominantExpressions Returns the Arcade and SQL expressions used for creating a predominance renderer. These expressions are used to query a feature service or the client-side layer for statistics relevant to creating the default predominance renderer for the given fields.
Example:
const predominanceExpressions = predominanceUtils.getPredominanceExpressions({
  layer: featureLayer,
  fields: ["Corn", "Wheat", "Soybeans", "Vegetables", "Cotton"]
});

console.log(`value expression for getting the predominant category from the given fields: ${predominanceExpressions.predominantCategory.valueExpression}`);

Type Definitions

OpacityExpressionInfo

Contains the Arcade and SQL expressions used to query feature services and client-side layers for the strength of the predominant category compared with all other categories. In other words, these expressions should calculate the percentage of the sum the winning value comprises.

Properties:
valueExpression String

An Arcade expression following the specification defined by the Arcade Visualization Profile. The expression should be used to calculate the percentage the winning field comprises among of a set of numeric fields. It may reference field values using the $feature global variable and must return a number.

statisticsQuery SQLExpressionInfo

The SQL expressions used for querying the percentage the predominant value comprises among of a set of fields. This expression should match the logic of the Arcade expression.

histogramQuery SQLExpressionInfo

The SQL expressions used for querying the histogram using the percentage the predominant value comprises among of a set of fields.

PredominantExpressions

The result object returned from the getAgeExpressions() method.

Properties:
predominantCategory Object

The Arcade expression used to get the predominant category among a set of fields.

Specification:
valueExpression String

valueExpression - An Arcade expression following the specification defined by the Arcade Visualization Profile. The expression should be used to return the name of the predominant field among a set of competing fields. It may reference field values using the $feature global variable and must return a string.

The Arcade and SQL expressions used to query the server or client-side layer for statistics of the sum of all competing fields considered for the predominance visualization.

The Arcade and SQL expressions used to query the server or client-side layer for statistics of the percentage among all competing fields comprised by the predominant category.

SizeExpressionInfo

Contains the Arcade and SQL expressions used to query feature services and client-side layers for the sum of all values considered in a predominance visualization.

Properties:
valueExpression String

An Arcade expression following the specification defined by the Arcade Visualization Profile. The expression should be used to calculate the sum of a set of numeric fields. It may reference field values using the $feature global variable and must return a number.

statisticsQuery SQLExpressionInfo

The SQL expressions used for querying the sum of a set of fields. This expression should match the logic of the Arcade expression.

histogramQuery SQLExpressionInfo

The SQL expressions used for querying the histogram for the sum of a set of fields.

SQLExpressionInfo

SQL expressions used to query feature services for predominant values and related statistics given a set of fields.

Properties:
sqlExpression String

The SQL expression used for querying the predominant category given a set of fields. This expression should match the logic of the Arcade expression in the parent info object.

sqlWhere String

The SQL where clause used to query the predominant value. This should be used to ensure negative values are not considered in the predominance calculation.

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