import * as ageUtils from "@arcgis/core/smartMapping/statistics/support/ageUtils.js";
const ageUtils = await $arcgis.import("@arcgis/core/smartMapping/statistics/support/ageUtils.js");
@arcgis/core/smartMapping/statistics/support/ageUtils
Provides utility functions for generating Arcade expressions intended for use in an age renderer.
Method Overview
| Name | Return Type | Summary | Object |
|---|---|---|---|
Returns an Arcade expression for visualizing the age of a feature based on a given start time and end time. | ageUtils |
Method Details
-
getAgeExpressions
MethodgetAgeExpressions(params){AgeExpressionsResult} -
Returns an Arcade expression for visualizing the age of a feature based on a given start time and end time.
ParametersSpecificationparams ObjectSee the table below for details of each parameter.
Specificationlayer FeatureLayer|SceneLayer|CSVLayer|GeoJSONLayer|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 StringoptionalThe desired units of the age result.
Possible Values:"years"|"months"|"days"|"hours"|"minutes"|"seconds"
ReturnsType Description AgeExpressionsResult Returns an instance of AgeExpressionsResult. Exampleconst ageExpressions = ageUtils.getAgeExpressions({ layer: featureLayer, startTime: "Created_Date", endTime: Date.now(), unit: "days" }); console.log(`value expression: ${ageExpressions.valueExpression}`);
Type Definitions
-
The result object returned from the getAgeExpressions() method.
- Properties
-
valueExpression String
An Arcade expression following the specification defined by the Arcade Visualization Profile. The expression should be used to calculate the age of a feature based on the difference between the end time and the start time. It may reference field values using the
$featureprofile variable and must return a number.statisticsQuery ObjectA SQL expression and where clause that matches the generated
valueExpressionused to query statistics from the layer.histogramQuery ObjectA SQL expression and where clause that matches the generated
valueExpressionused to query for a histogram from the layer.