ESRI JS API - CIMSymbol with text from graphic attribute

155
1
Jump to solution
05-06-2020 03:12 PM
TimLeigh
New Contributor

The following sample shows a great use of the CIMSymbol in the ESRI JS API.

https://developers.arcgis.com/javascript/latest/sample-code/cim-symbols/index.html

Is it possible to set the textString property on the markergraphic to an attribute of the graphic?

https://github.com/Esri/cim-spec/blob/master/docs/v2/CIMSymbols.md#cimmarkergraphic

I'd like to place a number (attribute of the graphic) in the centre of the symbol and have tried "{$feature.numfld}" but this just displays the text string, not the expresssion value.

0 Kudos
1 Solution

Accepted Solutions
AnneFitz
Esri Contributor

Hi Tim,

This is not currently possible for CIMSymbol. You could add labels to your FeatureLayer instead of doing it through the CIMSymbol. See this example: Add labels to a FeatureLayer | ArcGIS API for JavaScript 4.15 

There's more information available in the API Reference: FeatureLayer.labelingInfo | ArcGIS API for JavaScript 4.15 

Let me know if you have any questions. I hope this helps!

Thanks,

Anne

View solution in original post

0 Kudos
1 Reply
AnneFitz
Esri Contributor

Hi Tim,

This is not currently possible for CIMSymbol. You could add labels to your FeatureLayer instead of doing it through the CIMSymbol. See this example: Add labels to a FeatureLayer | ArcGIS API for JavaScript 4.15 

There's more information available in the API Reference: FeatureLayer.labelingInfo | ArcGIS API for JavaScript 4.15 

Let me know if you have any questions. I hope this helps!

Thanks,

Anne

View solution in original post

0 Kudos