require(["esri/smartMapping/statistics/support/predominanceUtils"], (predominanceUtils) => { /* code goes here */ });
import * as predominanceUtils from "@arcgis/core/smartMapping/statistics/support/predominanceUtils.js";
esri/smartMapping/statistics/support/predominanceUtils
Provides utility functions for generating Arcade and SQL expressions intended for use in an predominance renderer.
- See also
Method Overview
Name | Return Type | Summary | Object |
---|---|---|---|
Returns Arcade and SQL expressions used for visualizing the predominant category (or field) among a set of competing fields. | predominanceUtils |
Method Details
-
getPredominanceExpressions
getPredominanceExpressions(layer, fieldNames){PredominantExpressions}
-
Returns Arcade and SQL expressions used for visualizing the predominant category (or field) among a set of competing fields.
Parameterslayer FeatureLayer|SceneLayer|CSVLayer|GeoJSONLayer|WFSLayer|OGCFeatureLayer|StreamLayer|OrientedImageryLayer|CatalogFootprintLayer|KnowledgeGraphSublayer|SubtypeGroupLayer|SubtypeSublayerThe layer from which to generate the Arcade and SQL expressions for querying predominance statistics.
An array of numeric field names for which to create the Arcade and SQL expressions used to build the predominance renderer.
ReturnsType 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. Exampleconst 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
-
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
profile variable and must return a number.statisticsQuery SQLExpressionInfoThe 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 SQLExpressionInfoThe SQL expressions used for querying the histogram using the percentage the predominant value comprises among of a set of fields.
-
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
profile variable and must return a string.
size SizeExpressionInfoThe 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.
opacity OpacityExpressionInfoThe 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.
-
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 StringThe SQL where clause used to query the predominant value. This should be used to ensure negative values are not considered in the predominance calculation.
-
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
profile variable and must return a number.statisticsQuery SQLExpressionInfoThe SQL expressions used for querying the sum of a set of fields. This expression should match the logic of the Arcade expression.
histogramQuery SQLExpressionInfoThe SQL expressions used for querying the histogram for the sum of a set of fields.