summaryStatistics

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

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

Known Limitations

Method Overview

NameReturn TypeSummaryFunction
Promise<SummaryStatisticsResult>

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

more details
more detailssummaryStatistics

Method Details

summaryStatistics(params){Promise<SummaryStatisticsResult>}

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

Parameters:
params Object

See the table below for details of each parameter.

Specification:

The layer from which to generate statistics for the given field.

field String
optional

The name of the numeric field for which the summary statistics will be generated. This property is ignored if a valueExpression is used.

valueExpression String
optional

An Arcade expression that returns a number. This expression can reference field values using the $feature global variable. This property overrides the field property and therefore is used instead of an input field value.

sqlExpression String
optional

A SQL expression evaluating to a number.

sqlWhere String
optional

A SQL where clause used to filter features for the statistics query. For example, this is useful in situations where you want to avoid dividing by zero as is the case with creating a predominance visualization.

normalizationField String
optional

The field by which to normalize the values returned from the given field.

minValue Number
optional

The minimum bounding value for the statistics calculation. Use this in conjunction with maxValue to generate statistics between lower and upper bounds.

maxValue Number
optional

The maximum bounding value for the statistics calculation. Use this in conjunction with minValue to generate statistics between lower and upper bounds.

view View
optional

A SceneView or MapView instance is required when a valueExpression is specified.

features Graphic[]
optional

A subset of features for which to calculate the statistics.

Returns:
TypeDescription
Promise<SummaryStatisticsResult>Returns a promise that resolves to SummaryStatisticsResult.
Example:
summaryStatistics({
  layer: featureLayer,
  valueExpression: "( ($feature.POP2020 - $feature.POP2010) / $feature.POP2010 ) * 100"
  view: mapView
}).then(function(stats){
  colorSlider.statistics = stats;
});

Type Definitions

SummaryStatisticsResult

The statistics returned from the summaryStatistics() query.

Properties:
avg Number

The average of all values returned from the field or expression.

count Number

The number of features evaluated.

max Number

The maximum of all values returned from the field or expression.

min Number

The minimum of all values returned from the field or expression.

stddev Number

The standard deviation calculated from values returned from the field or expression.

sum Number

The sum of all values returned from the field or expression.

variance Number

The calculated variance from all values returned from the field or expression.

API Reference search results

NameTypeModule
Loading...