Skip to content
import summaryStatistics from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
Since
ArcGIS Maps SDK for JavaScript 4.2

Function for generating attribute statistics in a Layer based on values returned from a given field.

Known Limitations

SceneLayers must have the supportsRenderer and supportsLayerQuery capabilities enabled unless a predefined statistics object is provided to the statistics parameter of the method. To check a SceneLayer's capabilities, use the SceneLayer.getFieldUsageInfo() method. You cannot generate statistics using SQL expressions for client-side FeatureLayers in a SceneView. The normalizationType parameter only normalizes data returned by a field. It does not apply to values returned from a valueExpression or sqlExpression.

Functions

summaryStatistics

Function

Returns an object containing statistics describing a set of values returned from a field (or expression) in a Layer.

Signature
summaryStatistics (parameters: SummaryStatisticsParameters): Promise<SummaryStatisticsResult>
Parameters
ParameterTypeDescriptionRequired
parameters

The function parameters.

Returns
Promise<SummaryStatisticsResult>

Returns a promise that resolves to SummaryStatisticsResult.

Examples
summaryStatistics({
layer: featureLayer,
valueExpression: "( ($feature.POP2020 - $feature.POP2010) / $feature.POP2010 ) * 100"
view: mapView
}).then((stats) => {
colorSlider.statistics = stats;
});
summaryStatistics({
layer: featureLayer,
field: "Population",
normalizationType: "natural-log",
sqlWhere: "Population > 0",
numBins: 100
}).then((stats) => {
histogramElement.average = stats.avg;
});