Select to view content in your preferred language

Labeling of decimals, rounding/padding using LabelLayer

4889
10
Jump to solution
09-25-2015 08:35 AM
ZoeZaloudek
Occasional Contributor

I have a web map with a FeatureLayer (polygons).  I’m using a LabelLayer to label the polygons with a double-type field.  My values in the field go to the hundredth, but some don’t. (example image below)  I want to show all labels with values to the tenth, which means some will have to be rounded, and others will have to be padded on the right with “.0”

I know how to do this in ArcMap - go to the layer’s attribute table, go to the field’s numeric properties, set how many decimal places to show, also check the ‘Pad with zeros’ box. How do I accomplish this with my web map? I can’t find a decimal places setting in the documentation for LabelLayer...   Is there a round/pad function I can use in the textExpression of the addFeatureLayer method?  Or is there a way to set field display properties in the map service?

decimallabels.png

0 Kudos
10 Replies
KellyHutchins
Esri Frequent Contributor

Tracy Schloss​ yes LabelClass works with FeatureLayers too. The example I posted is using a feature layer. We are currently working on updating the doc for labelling so at the next release it should be more clear.

0 Kudos