Adjusting text symbol attributes on zoom

1068
3
Jump to solution
01-15-2018 10:52 AM
yangwen
New Contributor III

My feature layer has text symbols.  I need to dynamically adjust the font size property of the text or hide them altogether, based on the zoom level of the mapview.

What is the pattern to achieve this? I have a watch function on the view.stationary property so I know when the zoom is occurring.  However I can't just loop through the layers and change the fontSize property and expect it to reflect on screen - There is no binding between the layer instances and the DOM.  Do I just need to brut force it - Delete textSymbol graphics and re-add them with a different font-size?

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Yang,

 if using 4.6 there is a refresh method on most layers. Have you tried that?

View solution in original post

3 Replies
RobertScheitlin__GISP
MVP Emeritus

Yang,

 if using 4.6 there is a refresh method on most layers. Have you tried that?

yangwen
New Contributor III

I have not.. the API describes it as:

refresh()
Since: ArcGIS API for JavaScript 4.6

Fetches all the data for the layer.

It implies the use case where the Layer is sourced from a service URL..  However it may also include the manual instantiation method.  I'll give it a try.

0 Kudos
yangwen
New Contributor III

Worked! Thanks!

0 Kudos