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.
Procedure
- In the ArcGIS Pro project, turn on labels for the desired feature layer.
- In the Contents pane, right-click the feature layer and click Labeling Properties....
- In the Label Class pane, ensure Arcade is selected for Language.
- For Expression, configure the Arcade expression below in the expression box.
- 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.
- 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;
- Click Apply.
The image below shows the values in the labels are displayed in varying text formats.