HOW TO

Display labels in varying text formats using Arcade in ArcGIS Pro

Last Published: November 11, 2022

Summary

In ArcGIS Pro, Arcade expressions can be used to customize the format of labels displayed on a map. The custom Arcade expression in this article incorporates the split() function to display the values in labels in varying fonts, colors, or sizes. In this example, the values in the SUBREGION field are displayed as labels on the map.

Polygon features with labels on a map.

Procedure

  1. In the ArcGIS Pro project, turn on labels for the desired feature layer.
  2. In the Contents pane, right-click the feature layer and click Labeling Properties....
  3. In the Label Class pane, ensure Arcade is selected for Language.
  4. For Expression, configure the Arcade expression below in the expression box.
    1. For the split() expression, replace <field_name> with the name of the field containing the values, and replace <delimiter> with the delimiter in the value.
    2. Modify the formatting for the text appearance. Refer to ArcGIS Pro: Text formatting tags for more information on the formatting elements and tags supported in ArcGIS Pro. In this example, the expression is configured to display the value before the delimiter in Times New Roman with a font size of 18, and the value after the delimiter in blue color with a font size of 10.
var label1 = Split($feature.<field_name>, "<delimiter>");
var output = `<FNT name='Times New Roman' size='18'>${label1[0]}</FNT>`;
if (Count(label1) > 1) {
  output += ` <CLR blue ='255'><FNT size = '10'> ${label1[1]}</FNT></CLR>`;
}
return output;
The custom Arcade expression in the Expression box in the Label Class pane.
  1. Click Apply.

The image below shows the values in the labels are displayed in varying text formats.

Polygon features with labels containing different text styles enabled on a map.

Article ID:000028662

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

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Related Information

Discover more on this topic