import summaryStatisticsForAge from "@arcgis/core/smartMapping/statistics/summaryStatisticsForAge.js";
const summaryStatisticsForAge = await $arcgis.import("@arcgis/core/smartMapping/statistics/summaryStatisticsForAge.js");
@arcgis/core/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. | summaryStatisticsForAge |
Method Details
-
summaryStatisticsForAge
MethodsummaryStatisticsForAge(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|ParquetLayer|WFSLayer|OGCFeatureLayer|StreamLayer|OrientedImageryLayer|CatalogFootprintLayer|KnowledgeGraphSublayer|SubtypeGroupLayer|SubtypeSublayerThe layer from which to generate age statistics for the given
startTimeandendTime.The start time for the age calculation. This can be a field name or a date value, such as
Date.now(). If aDateis provided, then theendTimeparameter 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 aDateis provided, then thestartTimeparameter 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.
outStatisticTypes ObjectoptionalSince 4.31 Indicates the statistics to calculate. If not defined, all statistics are calculated by default. The object should have the following properties.
Specificationinclude OutStatisticType[]optionalThe statistics to include in the calculation.
exclude OutStatisticType[]optionalThe statistics to exclude from the calculation. Some statistics, such as
median, are computationally expensive to calculate and may be excluded to improve performance.filter FeatureFilteroptionalSince 4.31 When defined, only features included in the filter are considered in the attribute and spatial statistics calculations when determining the final renderer. This is useful when a lot of variation exists in the data that could result in undesired data ranges. A common use case would be to set a filter that only includes features in the current extent of the view where the data is most likely to be viewed. Currently, only geometry filters with an
intersectsspatial relationship are supported. All other filter types (includingwhere) are ignored.signal AbortSignal|null|undefinedoptionalAllows 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}`); });