Visualization

The visualization profile allows the map author to write an expression that evaluates to a value used to drive the visualization. This could be used for a visual variable such as size, or as a value in a class breaks renderer. When the feature is to be drawn, the script will be evaluated. It is expected that the script returns a value specific to the rendering property being calculated (e.g. A number for a class breaks visualization or text for a unique value visualization).

Context

The following products implement this profile:

Spatial reference

The spatial reference of the map in which the expression executes determines the execution context's spatial reference.

Time zone

The time zone of the map in which the expression executes determines the execution context's default time zone.

Profile variables

Variable NameTypeDescriptionSince version
$featureFeatureThe feature which is to be drawn on the map.1.0
$view.scaleNumberThe scale of the map at the time the expression evaluates. Only supported in 2D MapViews.1.0
$view.timeProperties.currentStartDateThe start time of the map's time extent as indicated by a time slider component at the time the expression evaluates. This value dynamically updates (and may trigger the re-execution of the Arcade expression) when a time slider is used to update time-aware visualizations based on date field. A null value indicates the start time is inclusive since the beginning of time. This value is currently not available in ArcGIS Online or the ArcGIS Maps SDK for JavaScript.1.28
$view.timeProperties.currentEndDateThe end time of the map's time extent as indicated by a time slider component at the time the expression evaluates. This value dynamically updates (and may trigger the re-execution of the Arcade expression) when a time slider is used to update time-aware visualizations based on date field. A null value indicates the end time is indefinite with no end. This value is currently not available in ArcGIS Online or the ArcGIS Maps SDK for JavaScript.1.28
$view.timeProperties.startIncludedBooleanIndicates if the currentStart date is included in the map's current time extent. This value is currently not available in ArcGIS Online or the ArcGIS Maps SDK for JavaScript.1.28
$view.timeProperties.endIncludedBooleanIndicates if the currentEnd date is included in the map's current time extent. This value is currently not available in ArcGIS Online or the ArcGIS Maps SDK for JavaScript.1.28

Function bundles

Core | Geometry

Return types

Text | Number

Examples

Calculates the predominant political party within each feature.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
var republican = $feature.MP06025a_B;
var democrat = $feature.MP06024a_B;
var independent = $feature.MP06026a_B;
var parties = [republican, democrat, independent];

return Decode( Max(parties),
  republican, 'republican',
  democrat, 'democrat',
  independent, 'independent',
  'n/a'
);

Calculates the number of days between the datetime on the feature and the current start time of the map.

Use dark colors for code blocksCopy
1
2
3
4
5
if (HasValue($view, ["timeProperties", "currentStart"])) {
  return DateDiff($feature.datetime, $view.timeProperties.currentStart, 'days');
} else {
  return -1;
}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.