ESRI JS API - CIMSymbol with text from graphic attribute

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

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 Regular 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 Regular 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

0 Kudos