HOW TO

Label or symbolize a feature layer with a range of percentages using Arcade in ArcGIS Pro

Last Published: December 21, 2022

Summary

In ArcGIS Pro, numeric data in a feature layer, such as the crime ratio of cities, can be labeled or symbolized using a range of percentages. In this article, an Arcade expression is used to create labels or symbolize a feature layer with the desired range of percentages.

Procedure

Display the percentage range as labels

  1. Open the ArcGIS Pro project, add the layer, and create the label expression. For instructions, refer to Steps 1 through 4 in ArcGIS Pro: Writing a label expression, and select Arcade for Language.
Note:
Ensure the selected feature layer and feature class check boxes are checked in the Contents pane to display the labels.
The feature class and feature layer check boxes are checked.
  1. Insert and configure the expression below in the Expression box:
var <variable_name> = $feature.<field_name>

if (<variable_name> <= <field_value>) {
    return "<range of percentage>";
} else if (<variable_name> <= <field_value>) {
    return "<range of percentage>";
} else if (<variable_name> <= <field_value>) {
    return "<range of percentage>";
} else {
    return "<range of percentage>";
}
  1. Replace <field_name> with the name of the field to display the range of percentages as labels. In this example, ‘Ratio’ is the selected field.
  2. Replace <variable_name> with the desired variable name. In this example, ‘Ratio’ is the variable name.
  3. Replace <field_value> with the desired field’s values from the attribute table.
  4. Replace <range of percentages> with the desired text for the labels. In this example, the range for the percentages are used as the texts.
Note:
The number for the range of percentages can be specified as per the requirement of the field’s attribute value.
  1. Click the Verify button to validate the expression.
  2. Click Apply to run the script.
Label class window with expression specified in the expression box.

The image below displays the range of percentages for the field as labels on a map.

Percentage range of field value labeled on the map.

Display the range of percentages with the unique value symbology in a layout

  1. Open the ArcGIS Pro project.
  2. Symbolize the feature layer with the unique value symbology. For instructions, refer to Steps 1 through 2 in ArcGIS Pro: Unique values. In this example, ‘Ratio’ is the selected field.
  3. Click the expression button Experession buttom icon. to open the Expression Builder dialog box.
  4. Insert and configure the expression below in the Expression box:
var <variable_name> = $feature.<field_name>

if (<variable_name> <= <field_value>) {
    return "<range of percentage>";
} else if (<variable_name> <= <field_value>) {
    return "<range of percentage>";
} else if (<variable_name> <= <field_value>) {
    return "<range of percentage>";
} else {
    return "<range of percentage>";
}
  1. Replace <field_name> with the name of the field to display the range of percentages for the symbology. In this example, ‘Ratio’ is the selected field.
  2. Replace <variable_name> with the desired variable name. In this example, ‘Ratio’ is the variable name.
  3. Replace <field_value> with the desired field’s values from the attribute table.
  4. Replace <range of percentages> with the desired text for the legend.
    Note:
    The number for the range of percentages can be specified as per the requirement of the field’s attribute value.
    
    1. Click the Verify button to validate the expression.
    2. Click OK to run the script.
    Ex
    1. Insert a layout and map frame for the map. Refer to ArcGIS Pro: Insert a layout and ArcGIS Pro: Insert a map frame for instructions.
    2. In the layout view, on the top ribbon, in the Map Surrounds group, click Legend and create a legend to display the range of percentages for the values of the field.

    The image below displays the range of percentages for the field represented through the unique value symbology in a layout.

    Percentage range of field value displayed on a legend in a layout.

    Article ID: 000028947

    Software:
    • ArcGIS Pro 3 0
    • ArcGIS Pro 2 8 x
    • ArcGIS Pro 2 7 x
    • ArcGIS Pro 2 x

    Receive notifications and find solutions for new or common issues

    Get summarized answers and video solutions from our new AI chatbot.

    Download the Esri Support App

    Related Information

    Discover more on this topic

    Get help from ArcGIS experts

    Contact technical support

    Download the Esri Support App

    Go to download options