Is it possible to have the X in the label Display in red?
Example :
719: X
I've tried this:
'<CLR red = "255">(": X")
</CLR>'
Hi Danville_GIS ,
There is no support voor defining colors and font style with Arcade in your labels at this moment. The only thing I can think of is to duplicate the layer and filter for this "Test" value and define the label color for each layer.
Seconding Xander Bakker to say there is no current support, unfortunately.
If you want to avoid having separate layers, you could create two expressions that would return each half of your if statement separately so you can apply HTML formats in the custom attribute display.
First Custom Expression {expression/expr0}
if ($feature.["FD_Status"] == 'Test') {
return '✓'
}
else {
return ''
}
Second Custom Expression {expression/expr1}
if ($feature.["FD_Status"] == 'Test') {
return ''
}
else {
return '☓'
}
Then in your custom attribute display, you would enter this in the html editor:
{FACILITYID}: {expression/expr0}<font color="#ff0000">{expression/expr1}</font>
It's cumbersome, but it's the best workaround I've found to control colors/styles on specific features.
P.S. I could have sworn I up-voted an ArcGIS Idea about including this kind of HTML in the AGOL attribute expression builder, but I can't find it now. If anyone remembers an idea like this, please post the link! Or create the idea and let us know so we can up-vote that one .
Hi,
Do you know if there's is support for defining colors and font style with Arcade in your labels now ? Thank you.
You can format your labels (color, font, font size...) in ArcGIS Pro.
More information in this help topic
@AmirBar-Maor why does the below not center the label in Pro?
"<FNT name = 'Roboto' style = 'Regular' size = '12' horizontal = 'center'>" + $feature.'PRIMARYZONENAME' + "</FNT>"
and worse, when I use this labelled layer in a (10.9.1.) webmap why does it display this?
For alignment, you need to use the <ALIGN> tag. See this topic for the supported list of tags and attributes. If you're setting it for all cases you can use stacking options to specify this too.
As for the webmap case, text formatting tags are not supported in webmaps at this time.
@XanderBakker, @AmirBar-Maor - Are there any updates here? Is there any plan to support this type of label configuration in ArcGIS Online?
Arcade is touted for it's ability to move between platforms, which is great when it works....until it doesn't. Basic globals like TextFormatting.NewLine (even though it's clearly listed as an option in expression construction), as well as formatting tags like the example above don't translate to AGOL. Which is a bummer. Can you offer insight?
TextFormatting.NewLine is supported in the new Map Viewer and the 4.x JavaScript API.
Text Formatting tags aren't an Arcade feature, they're a text symbol feature supported in ArcMap, ArcGIS Pro, and ArcGIS Runtime. I'd suggest submitting an Idea for the JavaScript API / Map Viewer for similar support conversations.
Thanks, @CraigWilliams for the tip about the new Map Viewer. I was unaware of that change.
If you're suggesting submitting an Idea in reference to the original post, I don't think one should have to. If the advertised purpose of the language is to move between platforms it should, you know, actually move between platforms. If a layer has a Arcade-formatted labeling expression in Pro it shouldn't be sabotaged once published to AGOL. Just my two cents.