Select to view content in your preferred language

Stacking Labels of Multiple Features

139
5
Friday
MasonFord
New Contributor

Is there a way to display labels in the same label class but different features as stacked? I have two polylines with identical geometry but have different values. Is there a way to display their labels as a stack instead of side by side?

0 Kudos
5 Replies
CodyPatterson
MVP Regular Contributor

Hey @MasonFord 

I'm curious if stacking separators should do this for you?

Here is a post that shows someone following a challenge to recreate symbology, but it shows similar to what you're asking I believe:

https://community.esri.com/t5/arcgis-pro-questions/a-complicated-labeling-challenge-multiple-values/...

Cody

0 Kudos
MasonFord
New Contributor

I read through this post before creating this one. I tried using the stacking separators and it did stack each label individually but the two labels were still side by side. If I could upload a picture it would be easier to explain but I don't see an option for that.

0 Kudos
CodyPatterson
MVP Regular Contributor

Hey @MasonFord 

You may be able to just paste it in here, or possibly upload to imgur or another image exchange if that works! 

Cody

0 Kudos
MasonFord
New Contributor

I was able to post it to ArcGIS Online and share it. 

https://vps.maps.arcgis.com/sharing/rest/content/items/b0f156276d2a4dd1ad49b9e58a5686f7/data

So I have two polylines in the same feature class with identical geometry. Both labels are part of the same label class. They both have different names (BFO 48RI & BFO 288RI). The labels are displayed side by side and I would like them stacked one on top of the other.  When I try to use stacking separators I end up with the BFO above the numbers but they are still side by side.

 

0 Kudos
Robert_LeClair
Esri Esteemed Contributor

So I found a way to do this using old school VBScript!  I'm sure there's a way to do this with Arcade but I've been struggling with that.  The syntax to copy/paste into the Expression box of the Label Class pane is:

Dim counter
counter = 0

Function FindLabel ([Label])
If Left([Label], 3) = "BFO" Then
counter = counter + 1
If counter Mod 2 = 1 Then
FindLabel = "<SUP>" & [Label] & "</SUP>"
Else
FindLabel = "<SUB>" & [Label] & "</SUB>"
End If
Else
FindLabel = [Label] ' If it doesn't start with "BFO", return the original label
End If
End Function

The result can be seen below.  One thing I had to change to make it work properly was on the Position tab in the Label Class pane, set the Label Buffer to 0%.  Then it stacks properly.

StackedLabels.JPG


0 Kudos