LabelLayer ignoring TimeExtent changes

885
3
Jump to solution
09-30-2014 01:00 PM
by Anonymous User
Not applicable

I'm using the esri/layers/LabelLayer module and have added a time-aware point FeatureLayer to it using the addFeatureLayer method.

The map has a TimeSlider.  When I change the time extent of the map, the labels for hidden points (outside of the time extent) remain displayed.

How do I get the LabelLayer to react to TimeExtent changes?

0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

Nevermind, I solved it by connecting a function to the map "time-extent-change" event that:

  1. creates an empty array to hold the names of visible features in the feature layer
  2. loops through the feature layer graphics
    • if the feature layer graphic is visible, then add its name to an array of visible features
  3. loops through the label layer graphics
    • if graphic.symbol.text is in the array of visible feature names, then call graphic.show() else call graphic.hide()

View solution in original post

0 Kudos
3 Replies
by Anonymous User
Not applicable

Nevermind, I solved it by connecting a function to the map "time-extent-change" event that:

  1. creates an empty array to hold the names of visible features in the feature layer
  2. loops through the feature layer graphics
    • if the feature layer graphic is visible, then add its name to an array of visible features
  3. loops through the label layer graphics
    • if graphic.symbol.text is in the array of visible feature names, then call graphic.show() else call graphic.hide()
0 Kudos
BjornSvensson
Esri Regular Contributor

martin schmoll‌ - FYI, this has been fixed for the soon-to-be-released 3.11 JSAPI.

0 Kudos
by Anonymous User
Not applicable

Ok that's great, thanks for letting me know.

0 Kudos