Hey All,
For my labels, I'd like to stack every single word in my label field into a new line.
Thus:
Student Recreation Center
Would become:
Student
Recreation
Center
Essentially, I just need to replace ever space ( ' ' ) with textFormatting.NewLine.
I could just calc a new field, with a lot of textFormatting, but it seems like there should be an easy way to do this within the code.
thanks,
~stefan
Solved! Go to Solution.
@WWUMap ,
Use arcade expression replace function:
Replace($feature["attributeFieldName"], ' ', textFormatting.NewLine);
Just string.replace(' ', textFormatting.NewLine), I would imagine.
https://www.w3schools.com/jsref/jsref_replace.asp
@jcarlson thanks for the idea. I didn't manage to get the string.replace syntax to work, in part because the arcade Replace did work. But I appreciate the suggestion.
~stefan
@WWUMap ,
Use arcade expression replace function:
Replace($feature["attributeFieldName"], ' ', textFormatting.NewLine);
@Kishore - Thanks!
The arcade Replace works great.
Here's the code:
const nameLabelClass = {
labelExpressionInfo: {expression: "Replace($feature.Name, ' ', textFormatting.NewLine )"},
};
~stefan