summaryStatisticsForAge
require(["esri/renderers/smartMapping/statistics/summaryStatisticsForAge"], function(summaryStatisticsForAge) { /* code goes here */ });
esri/renderers/smartMapping/statistics/summaryStatisticsForAge
Function for generating statistics for the age of features in a layer based on a given start time and end time.
Method Overview
Name | Return Type | Summary | Function | |
---|---|---|---|---|
Promise<SummaryStatisticsResult> | Returns an object containing various statistics describing an age value (e.g. more details | more details | summaryStatisticsForAge |
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 ObjectSee the table below for details of each parameter.
Specification:The layer from which to generate age statistics for the given
startTime
andendTime
.The start time for the age calculation. This can be a field name or a date value, such as
Date.now()
. If aDate
is provided, then theendTime
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 aDate
is provided, then thestartTime
parameter must be a field name.unit StringThe desired units of the age result.
Possible Values: years | months | days | hours | minutes | seconds
optional The view in which features will be rendered.
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}`); });