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:
- ArcGIS Pro
- ArcGIS Maps SDK for JavaScript
- ArcGIS Enterprise
- ArcGIS Online
- ArcGIS Maps SDKs for Native Apps
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 Name | Type | Description | Since version |
---|---|---|---|
$feature | Feature | The feature which is to be drawn on the map. | 1.0 |
$view | Dictionary | The properties available from the view, as defined in the table below. Only supported in 2D MapViews. | 1.0 |
Properties of $view
:
Variable Name | Type | Description | Since version |
---|---|---|---|
scale | Number | The scale of the map at the time the expression evaluates. Only supported in 2D MapViews. | 1.0 |
timeProperties.currentStart | Date | The 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. | 1.28 |
timeProperties.currentEnd | Date | The 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. | 1.28 |
timeProperties.startIncluded | Boolean | Indicates if the current date is included in the map's current time extent. | 1.28 |
timeProperties.endIncluded | Boolean | Indicates if the current date is included in the map's current time extent. | 1.28 |
Function bundles
Return types
Examples
Calculates the predominant political party within each feature.
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.
if (HasValue($view, ["timeProperties", "currentStart"])) {
return DateDiff($feature.datetime, $view.timeProperties.currentStart, 'days');
} else {
return -1;
}