Hi, I'm trying to generate a compound labelling expression where I have something like a town name, and then add in a second value followed by that value's label. I.e. I'd love for the label to read something like
Portland
5 d.u. / 1 acre
I've written my expression as $feature.Town + textformatting.newline + $feature.ZoningStrictness + "d.u./ 1 acre"
My labels are returning as:
Portland
5d.u./ 1 acre
If I change my expression to include: $feature.Town + textformatting.newline + $feature.ZoningStrictness + " " + "d.u./ 1 acre" (adding a space before the d.u./1 acre) it changes my expression to:
Portland
5
d.u./ 1 acre
Is there a way to add a space but not force a new line?
Solved! Go to Solution.
I'd check your label settings. If you aren't specifically asking for a line break but are getting one, I would guess that you have something in the label settings for wrapping on characters, or else having a character limit before wrapping to a new line.
What happens if you write the whole thing in a template literal instead?
`${$feature.Town}
${$feature.ZoningStrictness} d.u./ 1 acre`
I'd check your label settings. If you aren't specifically asking for a line break but are getting one, I would guess that you have something in the label settings for wrapping on characters, or else having a character limit before wrapping to a new line.
What happens if you write the whole thing in a template literal instead?
`${$feature.Town}
${$feature.ZoningStrictness} d.u./ 1 acre`
You could try a non-breaking white space character also. See https://en.wikipedia.org/wiki/Non-breaking_space.
Tyler
Hmmm. I copy pasted your string and I got a break at the / so I believe it to be a text wrapping issue.
Give template literals a try.
return `${$feature.Town}\n${$feature.ZoningStrictness} d.u. / 1 acre`
I did use TylerT's suggestion but it turned out I had Stacking enabled which was casuing the issue it fixed as soon as I unchecked the box