AnsweredAssumed Answered

Using a LabelLayer on map.graphics?

Question asked by Nighteyez07 on May 29, 2014
Latest reply on May 30, 2014 by Nighteyez07
All examples I've seen when using the LabelLayer shows using a feature layer. I'm trying to figure out in my app is can I use the map.graphics layer as the layer set for the Label layer? When I try it now it fails and I'm wondering if there's a way to make it work. I was hoping to use this as I've used it in the past with a featurelayer for users adding graphics and it was great to show titles on the screen. When a graphic was added, boom, the label was shown. When a graphic removed, boom, the correlating label was also removed.

I know I can go old school and manually add text symbols to the map.graphics layer. But I was hoping for a more elegant solution if possible.

var symbol = new TextSymbol(); var renderer = new SimperRenderer(symbol); var labelLayer = new LabelLayer(); labelLayer.addFeatureLayer(map.graphics, renderer, "${TITLE}"); map.addLayer(labelLayer);

Outcomes