HOW TO
In Portal for ArcGIS or ArcGIS Online Map Viewer, labelling a feature class with fractions can be an efficient method to represent statistical analysis. It also provides comparisons between different areas or data points, for example, comparisons of the fraction of renewable energy use across regions.
This article describes the workflow to create the fractions as labels using ArcGIS Arcade in Portal for ArcGIS and ArcGIS Online Map Viewer.
var fieldA = $feature["<fieldName1>"];
var fieldB = $feature["<fieldName2>"];
if (fieldB == 0) {
return "undefined";
}
var fraction = Text(fieldA, "#") + " / " + Text(fieldB, "#");
return fraction;
The code below demonstrates the full working script.
var fieldA = $feature["Numbers"];
var fieldB = $feature["TestNumber"];
if (fieldB == 0) {
return "undefined"; // or return some default value or message
}
var fraction = Text(fieldA, "#") + " / " + Text(fieldB, "#");
return fraction;
The map shows the fractions displayed as labels in Portal for ArcGIS and ArcGIS Online Map Viewer.
Article ID: 000032736
Get help from ArcGIS experts
Download the Esri Support App