summaryStatisticsForAge

require(["esri/smartMapping/statistics/summaryStatisticsForAge"], function(summaryStatisticsForAge) { /* code goes here */ });
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

NameReturn TypeSummaryFunction
Promise<SummaryStatisticsResult>

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

more details
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.

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.

optional

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

Returns:
TypeDescription
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}`);
});

API Reference search results

NameTypeModule
Loading...