AnsweredAssumed Answered

Adding labels to a GraphicsLayer (API version 3)

Question asked by btagis on May 27, 2016
Latest reply on May 27, 2016 by btagis

I'd like to arbitrarily label elements within a GraphicsLayer, using the appropriate label-position values from the client-side labeling engine. This would need to be done per-graphic, as this GraphicsLayer can contain multiple geometry types. There are a number of posts on this, but none have an appropriate solution.


A member of ESRI staff posted an example which worked under API 3.9, but is broken in subsequent releases:


Other solutions involve adding extra FeatureLayers to then either assign to LabelLayer (which is deprecated), or use the now preferred labeling capabilities of the FeatureLayer itself.


Our use case: we use a GraphicsLayer to manage a "saved items" panel on our fairly sophisticated JSAPI-v3-driven web GIS. Our users want to be able to label graphics without the hack method if adding a TextSymbol "somewhere underneath the blob". This is horrific, and our users often end up with junk print outputs. I've experimented with running labelled FeatureLayers for each geometry type in the background, but this too is horribly compromised, and adds a lot of processing overhead to an already complex application.


Any suggestions appreciated.