require(["esri/smartMapping/statistics/summaryStatisticsForAge"], (summaryStatisticsForAge) => { /* code goes here */ });
import summaryStatisticsForAge from "@arcgis/core/smartMapping/statistics/summaryStatisticsForAge.js";
esri/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 |
---|---|---|---|
Returns an object containing various statistics describing an age value (e.g. | summaryStatisticsForAge |
Method Details
-
summaryStatisticsForAge
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.
ParametersSpecificationparams ObjectSee the table below for details of each parameter.
Specificationlayer FeatureLayer|SceneLayer|CSVLayer|GeoJSONLayer|WFSLayer|OGCFeatureLayer|StreamLayer|OrientedImageryLayer|CatalogFootprintLayer|KnowledgeGraphSublayerThe 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.
signal AbortSignaloptionalAllows for cancelable requests. If canceled, the promise will be rejected with an error named
AbortError
. See also AbortController.ReturnsType Description Promise<SummaryStatisticsResult> Returns a promise that resolves to SummaryStatisticsResult. ExamplesummaryStatisticsForAge({ 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}`); });