require(["esri/smartMapping/statistics/support/ageUtils"], function(ageUtils) { /* code goes here */ });
Object: esri/smartMapping/statistics/support/ageUtils
Since: ArcGIS API for JavaScript 4.13

Provides utility functions for generating Arcade expressions intended for use in an age renderer.

Moved from esri/renderers/smartMapping/... at 4.16.

Method Overview

NameReturn TypeSummaryObject
AgeExpressionsResult

Returns an Arcade expression for visualizing the age of a feature based on a given start time and end time.

more details
more detailsageUtils

Method Details

getAgeExpressions(params){AgeExpressionsResult}

Returns an Arcade expression for visualizing the age of a feature based on a given start time and end time.

Parameters:
Specification:
params Object

See the table below for details of each parameter.

Specification:

The layer from which to generate age statistics for the given startTime and endTime.

startTime Date|String|Number

The start time for the age calculation. This can be a field name or a date value, such as Date.now(). If a Date is provided, then the endTime 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 a Date is provided, then the startTime parameter must be a field name.

unit String
optional

The desired units of the age result.

Possible Values:"years"|"months"|"days"|"hours"|"minutes"|"seconds"

Returns:
TypeDescription
AgeExpressionsResultReturns an instance of AgeExpressionsResult.
Example:
const ageExpressions = ageUtils.getAgeExpressions({
  layer: featureLayer,
  startTime: "Created_Date",
  endTime: Date.now(),
  unit: "days"
});

console.log(`value expression: ${ageExpressions.valueExpression}`);

Type Definitions

AgeExpressionsResult

The result object returned from the getAgeExpressions() method.

Properties:
valueExpression String

The Arcade expression used to calculate the age of a feature based on the difference between the end time and the start time.

statisticsQuery Object

A SQL expression and where clause that matches the generated valueExpression used to query statistics from the layer.

histogramQuery Object

A SQL expression and where clause that matches the generated valueExpression used to query for a histogram from the layer.

API Reference search results

NameTypeModule
Loading...