require(["esri/smartMapping/statistics/support/ageUtils"], (ageUtils) => { /* code goes here */ });
import * as ageUtils from "@arcgis/core/smartMapping/statistics/support/ageUtils.js";
esri/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
getAgeExpressions(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
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 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
$feature
profile variable and must return a number.statisticsQuery ObjectA SQL expression and where clause that matches the generated
valueExpression
used to query statistics from the layer.histogramQuery ObjectA SQL expression and where clause that matches the generated
valueExpression
used to query for a histogram from the layer.