Create a custom visualization using an Arcade expression

Loading...

Note: Support for 3D on mobile devices may vary, view the system requirements for more information.

This sample demonstrates how to create a data-driven visualization of unique values with an Arcade expression. Arcade is useful for creating visualizations in a FeatureLayer based on a value generated from an expression instead of a field value.

In this sample, a layer whose features represent counties in the U.S. is added to the map. Each feature contains a total count for registered republicans, democrats, and independents in the county. If you wanted to shade each county with a different color depending on the dominant party in the county, you could do so by referencing an additional field indicating the dominant party. In this case, there isn't a field for dominant political party. Arcade allows you to write a simple expression that evaluates to the predominant party. This expression is passed to the valueExpression property of the UniqueValueRenderer.

You can also optionally pass an arcade expression to a visual variable. In this sample we also pass an expression to an opacity visual variable to indicate which counties are more lopsided in their support for a particular party.

The Arcade expressions used in this sample are described in more detail in the Visualization profile of the Arcade expressions guide.

Sample search results

TitleSample
Loading...