ArcGIS: Master Arcade Expressions with Custom Dashboards

By Katherine

ArcGIS Dashboard, a robust and powerful tool by Esri, offers unmatched versatility in creating dynamic, interconnected, and data-driven dashboards. One of its standout features is the use of Arcade expressions, which bring interactivity and smart automation to your dashboards. Today, we're diving deep into the world of ArcGIS Dashboard and Arcade expressions.

Dashboards in ArcGIS
Dashboards in ArcGIS

Before we dive into the specifics of Arcade expressions, let's briefly understand their significance. Arcade expressions allow you to create workflows, perform calculations, make decisions, and manipulate data directly within your dashboards. This empowers you to build dynamic, responsive, and incredibly useful dashboards that can adapt to user input and conditions.

Designing Effective Dashboards
Designing Effective Dashboards

Understanding Arcade Expressions

Arcade expressions are essentially textual scripts written in the Arcade scripting language. They can be used anywhere a calculated value is required, enabling real-time computations and data manipulation within your dashboards. Arcade is designed to be easy to learn and use, yet powerful enough to handle complex logical operations and data transformations.

Arcade
Arcade

Arcade expressions are used within curly braces ({ }) in your dashboard's configuration. For instance, you might use an Arcade expression to set the visibility of an element: { $feature.Text == "Visible" }, where $feature.Text refers to a field in your data that decides whether the element should be visible or not.

Arcade Data Types

the website design for an interactive video game
the website design for an interactive video game

Arcade expressions work with a variety of data types, including string, number, boolean, array, and object. Understanding these data types is key to creating effective Arcade expressions. For example, the following expression checks if a field named 'TaskStatus' is equal to 'completed':

{ $feature.TaskStatus == "completed" }

Here, 'TaskStatus' is a string, and the expression returns a boolean value (true or false) based on the comparison.

Arcade Functions and Operators

Дашборд
Дашборд

Arcade comes with a comprehensive set of functions and operators to perform various operations. You can perform mathematical operations (like addition, subtraction, multiplication, and division), logical operations (like AND, OR, NOT, and XOR), and much more. Here's a simple expression using the toUpperCase() function to convert string to uppercase:

{ $feature.Name.toUpperCase() }

In this case, '$feature.Name' is a string, and toUpperCase() is an Arcade function that converts the string to uppercase.

Arcade in Action: Dynamic Dashboard Elements

an image of a screen with buttons on it and the words arcade stick written below
an image of a screen with buttons on it and the words arcade stick written below

Now that we've covered the basics of Arcade expressions, let's look at how they can be used to create dynamic dashboard elements.

Let's say you want to create a "Traffic Light" indicator on your dashboard that changes color based on a 'TrafficDensity' field in your data. You can use an Arcade expression to set the color of the indicator. The following example uses the switch() function to set the color based on the value of 'TrafficDensity':

an image of the back side of a computer screen with text and pictures on it
an image of the back side of a computer screen with text and pictures on it
Gaming Dashboard Ui Design, Daily Task
Gaming Dashboard Ui Design, Daily Task
an image of a dashboard with purple and pink colors
an image of a dashboard with purple and pink colors
an old arcade machine with the number 8 on it's screen and numbers in front
an old arcade machine with the number 8 on it's screen and numbers in front
an image of a computer screen with different items on it and the text event info below
an image of a computer screen with different items on it and the text event info below
the dashboard screen is showing different types of graphs and data on it's display
the dashboard screen is showing different types of graphs and data on it's display
an arcade game with a man standing in front of the building and two vending machines
an arcade game with a man standing in front of the building and two vending machines
the dashboard screen shows that there are many things to see in this page, including data and statistics
the dashboard screen shows that there are many things to see in this page, including data and statistics
the letters are made up of different colored squares and lines on a white background with red, blue, and black stripes
the letters are made up of different colored squares and lines on a white background with red, blue, and black stripes
App interfaces, dashboards, widgets
App interfaces, dashboards, widgets

{ switch($feature.TrafficDensity){
    case 0: return "Green";
    case 1: return "Yellow";
    default: return "Red";
   }
}

Here, the switch() function checks the value of 'TrafficDensity' and returns the corresponding color for the traffic light indicator.

Using Arcade with Depending On

Arcade expressions can also be used with the 'depending on' option in dashboard elements. This allows you to show or hide elements based on certain conditions. For instance, you might want to show a 'Traffic Alert' message when 'TrafficDensity' is 2 or above:

Hide/Show condition: { $feature.TrafficDensity >= 2 }

In this case, the 'Traffic Alert' element will only be visible when the 'TrafficDensity' is 2 or above.

Conditional Formatting with Arcade

Arcade expressions can also be used to apply conditional formatting to your data. This allows you to highlight specific features based on certain conditions. The following expression highlights 'CriticalInfrastructure' when 'TrafficDensity' is 2 or above:

Highlight expression: { $feature.TrafficDensity >= 2 && $feature.Type == "CriticalInfrastructure" }

Here, the expression will only apply the highlight to 'CriticalInfrastructure' features when the 'TrafficDensity' is 2 or above.

In the realm of data visualization, Arcade expressions open up a world of possibilities. They enable you to create more dynamic, responsive, and insightful dashboards, transforming your data into meaningful and actionable information. So, start exploring Arcade expressions today and elevate your ArcGIS Dashboard experience!