summaryStatisticsForAge

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

Function for generating statistics for the age of features in a layer based on a given start time and end time.

Moved from esri/renderers/smartMapping/... at 4.16.

Method Overview

Name Return Type Summary Function
Promise<SummaryStatisticsResult>more details

Returns an object containing various statistics describing an age value (e.g.

more detailssummaryStatisticsForAge

Method Details

summaryStatisticsForAge(params){Promise<SummaryStatisticsResult>}

Returns an object containing various statistics describing an age value (e.g. the difference between a given end time from a start time) in a Layer.

Parameters:
Specification:
params Object

See the table below for details of each parameter.

Specification:

The layer from which to generate age statistics for the given startTime and endTime.

startTime Date|String|Number

The start time for the age calculation. This can be a field name or a date value, such as Date.now(). If a Date is provided, then the endTime parameter must be a field name.

endTime Date|String|Number

The end time for the age calculation. This can be a field name or a date value, such as Date.now(). If a Date is provided, then the startTime parameter must be a field name.

unit String

The desired units of the age result.

Possible Values:"years"|"months"|"days"|"hours"|"minutes"|"seconds"

optional

The view in which features will be rendered.

signal AbortSignal
optional

Allows for cancelable requests. If canceled, the promise will be rejected with an error named AbortError. See also AbortController.

Returns:
Type Description
Promise<SummaryStatisticsResult> Returns a promise that resolves to SummaryStatisticsResult.
Example:
summaryStatisticsForAge({
  layer: featureLayer,
  startTime: "Created_Date",
  endTime: Date.now(),
  unit: "days",
  view: mapView
}).then(function(stats){
  console.log(`Average age of open incidents in days: ${stats.avg}`);
});

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