TextSymbol Border & Background Do Not Work For Client-Side Graphic?

989
4
Jump to solution
11-10-2021 04:23 PM
TVlasschaert
New Contributor II

JS API 4.21:  Trying to create a TextSymbol for a Graphic in a GraphicsLayer (or the MapView.graphics) that has a background and/or a border, neither of which seem to work.

Basic sample:  https://jsbin.com/qurexuh/edit?html,output

TextSymbol doc indicates there are supported properties:

- backgroundColor
- borderLineColor
- borderLineSize

Halo works, but setting these values seems to have no effect.  Can't find anything on it, am I missing something?

Thx!

1 Solution

Accepted Solutions
Noah-Sager
Esri Regular Contributor

Hi @TVlasschaert, unfortunately, those properties are documented as only working when using TextSymbol with a MapImageLayer:

https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-TextSymbol.html#backgroun...

Down the road, we do plan on making some enhancements in this area to make those properties useful in other scenarios, like your use case.

View solution in original post

0 Kudos
4 Replies
Noah-Sager
Esri Regular Contributor

Hi @TVlasschaert, unfortunately, those properties are documented as only working when using TextSymbol with a MapImageLayer:

https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-TextSymbol.html#backgroun...

Down the road, we do plan on making some enhancements in this area to make those properties useful in other scenarios, like your use case.

0 Kudos
TVlasschaert
New Contributor II

Ah I see now.  Shoot - but thx.

Noah-Sager
Esri Regular Contributor

Yeah, I hear you. Feel free to mark my answer as the solution if you feel so inclined.

0 Kudos
Guy_srb
New Contributor III

Hi!

I've found a nice workaround for the backgroundColor issue:

You can use the haloColor and the haloSize properties as backgroundColor.

Just set the color you want and set the haloSize the same as the size of the Text.

0 Kudos