<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Labeling of decimals, rounding/padding using LabelLayer in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/labeling-of-decimals-rounding-padding-using/m-p/141166#M13130</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, I got LabelClass to work, so I've partially succeeded.&amp;nbsp; However, setting the fieldInfos&amp;gt;format&amp;gt;places doesn't seem to be doing the trick for me.&amp;nbsp; Here's the code I implemented.&amp;nbsp; The variables &lt;SPAN style="font-family: courier new,courier;"&gt;flayer&lt;/SPAN&gt;, &lt;SPAN style="font-family: courier new,courier;"&gt;field&lt;/SPAN&gt; and &lt;SPAN style="font-family: courier new,courier;"&gt;labelCDvSymbol&lt;/SPAN&gt; are defined earlier in my code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var labelsCDs = new LabelClass({labelExpressionInfo: {"value": "{"+field+"}"}, minScale: 10000000});
labelsCDs.fieldInfos = [{"fieldName": field, "format": {"places": 1}}]; 
labelsCDs.symbol = labelCDvSymbol;
console.log(labelsCDs);
fLayer.setLabelingInfo([labelsCDs]);&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The labels show the correct field and font/symbol, but they're still just not rounded/padded to the tenth.&amp;nbsp; I can see in the console that the fieldInfos&amp;gt;format&amp;gt;places has been set to 1.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="labelplaces.png" class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/129226_labelplaces.png" style="height: auto;" /&gt;&lt;IMG alt="labelplaces2.png" class="image-3 jive-image" src="https://community.esri.com/legacyfs/online/129233_labelplaces2.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 07:46:52 GMT</pubDate>
    <dc:creator>ZoeZaloudek</dc:creator>
    <dc:date>2021-12-11T07:46:52Z</dc:date>
    <item>
      <title>Labeling of decimals, rounding/padding using LabelLayer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/labeling-of-decimals-rounding-padding-using/m-p/141160#M13124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a web map with a FeatureLayer (polygons).&amp;nbsp; I’m using a LabelLayer to label the polygons with a double-type field.&amp;nbsp; My values in the field go to the hundredth, but some don’t. (example image below)&amp;nbsp; 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”&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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...&amp;nbsp;&amp;nbsp; Is there a round/pad function I can use in the textExpression of the addFeatureLayer method?&amp;nbsp; Or is there a way to set field display properties in the map service?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="decimallabels.png" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/128342_decimallabels.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Sep 2015 15:35:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/labeling-of-decimals-rounding-padding-using/m-p/141160#M13124</guid>
      <dc:creator>ZoeZaloudek</dc:creator>
      <dc:date>2015-09-25T15:35:58Z</dc:date>
    </item>
    <item>
      <title>Re: Labeling of decimals, rounding/padding using LabelLayer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/labeling-of-decimals-rounding-padding-using/m-p/141161#M13125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can round up to the nearest tenth programmatically with Math.ceil10(yourValue, -1) if that helps. But, since the data is coming from a FeatureLayer that might not work out very well. Maybe this will at least steer you in the right direction.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Sep 2015 16:26:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/labeling-of-decimals-rounding-padding-using/m-p/141161#M13125</guid>
      <dc:creator>TyroneBiggums</dc:creator>
      <dc:date>2015-09-25T16:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: Labeling of decimals, rounding/padding using LabelLayer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/labeling-of-decimals-rounding-padding-using/m-p/141162#M13126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you looked at this section: &lt;A href="https://developers.arcgis.com/javascript/jshelp/intro_formatinfowindow.html" title="https://developers.arcgis.com/javascript/jshelp/intro_formatinfowindow.html"&gt;Format info window content | Guide | ArcGIS API for JavaScript&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wonder if any of the techniques you can use for formatting infoWindows would work on a labelLayer?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Sep 2015 20:11:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/labeling-of-decimals-rounding-padding-using/m-p/141162#M13126</guid>
      <dc:creator>TracySchloss</dc:creator>
      <dc:date>2015-09-28T20:11:42Z</dc:date>
    </item>
    <item>
      <title>Re: Labeling of decimals, rounding/padding using LabelLayer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/labeling-of-decimals-rounding-padding-using/m-p/141163#M13127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/4260"&gt;Zoe Zaloudek&lt;/A&gt;​ You can do this using the LabelLayer class by specifying the number of places. Here's a jsbin that shows how to do this: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://jsbin.com/xuyipimosu/edit?html,css,js,output" title="http://jsbin.com/xuyipimosu/edit?html,css,js,output"&gt;JS Bin - Collaborative JavaScript Debugging&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And here's the relevant bit of code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Setup label properties &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var statesLabels = new LabelClass({&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; labelExpressionInfo: {"value": "{AVE_FAM_SZ}"},&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldInfos:[{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "fieldName": "AVE_FAM_SZ",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "format": {"places":2}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Apply label info to the feature layer &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; states.setLabelingInfo([statesLabels]);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Sep 2015 17:01:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/labeling-of-decimals-rounding-padding-using/m-p/141163#M13127</guid>
      <dc:creator>KellyHutchins</dc:creator>
      <dc:date>2015-09-30T17:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: Labeling of decimals, rounding/padding using LabelLayer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/labeling-of-decimals-rounding-padding-using/m-p/141164#M13128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does this work for FeatureLayers?&amp;nbsp; The documentation specifically says ArcGISDynamicMapServiceLayer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Sep 2015 17:14:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/labeling-of-decimals-rounding-padding-using/m-p/141164#M13128</guid>
      <dc:creator>TracySchloss</dc:creator>
      <dc:date>2015-09-30T17:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: Labeling of decimals, rounding/padding using LabelLayer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/labeling-of-decimals-rounding-padding-using/m-p/141165#M13129</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/4289"&gt;Tracy Schloss&lt;/A&gt;​ 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. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Sep 2015 17:17:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/labeling-of-decimals-rounding-padding-using/m-p/141165#M13129</guid>
      <dc:creator>KellyHutchins</dc:creator>
      <dc:date>2015-09-30T17:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: Labeling of decimals, rounding/padding using LabelLayer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/labeling-of-decimals-rounding-padding-using/m-p/141166#M13130</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, I got LabelClass to work, so I've partially succeeded.&amp;nbsp; However, setting the fieldInfos&amp;gt;format&amp;gt;places doesn't seem to be doing the trick for me.&amp;nbsp; Here's the code I implemented.&amp;nbsp; The variables &lt;SPAN style="font-family: courier new,courier;"&gt;flayer&lt;/SPAN&gt;, &lt;SPAN style="font-family: courier new,courier;"&gt;field&lt;/SPAN&gt; and &lt;SPAN style="font-family: courier new,courier;"&gt;labelCDvSymbol&lt;/SPAN&gt; are defined earlier in my code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var labelsCDs = new LabelClass({labelExpressionInfo: {"value": "{"+field+"}"}, minScale: 10000000});
labelsCDs.fieldInfos = [{"fieldName": field, "format": {"places": 1}}]; 
labelsCDs.symbol = labelCDvSymbol;
console.log(labelsCDs);
fLayer.setLabelingInfo([labelsCDs]);&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The labels show the correct field and font/symbol, but they're still just not rounded/padded to the tenth.&amp;nbsp; I can see in the console that the fieldInfos&amp;gt;format&amp;gt;places has been set to 1.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="labelplaces.png" class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/129226_labelplaces.png" style="height: auto;" /&gt;&lt;IMG alt="labelplaces2.png" class="image-3 jive-image" src="https://community.esri.com/legacyfs/online/129233_labelplaces2.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:46:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/labeling-of-decimals-rounding-padding-using/m-p/141166#M13130</guid>
      <dc:creator>ZoeZaloudek</dc:creator>
      <dc:date>2021-12-11T07:46:52Z</dc:date>
    </item>
    <item>
      <title>Re: Labeling of decimals, rounding/padding using LabelLayer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/labeling-of-decimals-rounding-padding-using/m-p/141167#M13131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Put that into the constructor of the LabelClass&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var labelsCDs = new LabelClass({
&amp;nbsp;&amp;nbsp;&amp;nbsp; labelExpressionInfo: {"value": "{"+field+"}"}, 
&amp;nbsp;&amp;nbsp;&amp;nbsp; minScale: 10000000,
&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldInfos: [{"fieldName": field, "format": {"places": 1}}],
&amp;nbsp;&amp;nbsp;&amp;nbsp; symbol: labelCDvSymbol
});&amp;nbsp; 
console.log(labelsCDs);&amp;nbsp; 
fLayer.setLabelingInfo([labelsCDs]); &lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You cannot set the properties of a class after it's been created. You have to use methods (which aren't available for this class).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:46:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/labeling-of-decimals-rounding-padding-using/m-p/141167#M13131</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-12-11T07:46:55Z</dc:date>
    </item>
    <item>
      <title>Re: Labeling of decimals, rounding/padding using LabelLayer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/labeling-of-decimals-rounding-padding-using/m-p/141168#M13132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hm, I edited my code to match, but that still didn't do it.&amp;nbsp; The label symbol looks different though.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="labelplaces3.png" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/129234_labelplaces3.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;It must be something else in my code that's messing it up.&amp;nbsp; There's a lot more going on in addition to the label changes - changing symbology, text, etc.&amp;nbsp; I figured out how to share on JS Bin (which I didn't even know about until I saw the examples that &lt;A href="https://community.esri.com/migrated-users/2525"&gt;Kelly Hutchins&lt;/A&gt; posted-thanks!) and put the whole thing here:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://jsbin.com/nerozuzowi/edit?html,css,js,output" title="http://jsbin.com/nerozuzowi/edit?html,css,js,output"&gt;JS Bin - Collaborative JavaScript Debugging&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Oct 2015 19:34:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/labeling-of-decimals-rounding-padding-using/m-p/141168#M13132</guid>
      <dc:creator>ZoeZaloudek</dc:creator>
      <dc:date>2015-10-01T19:34:18Z</dc:date>
    </item>
    <item>
      <title>Re: Labeling of decimals, rounding/padding using LabelLayer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/labeling-of-decimals-rounding-padding-using/m-p/141169#M13133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The problem was the version of the API. It works in v3.14, but not 3.13.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Oct 2015 20:00:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/labeling-of-decimals-rounding-padding-using/m-p/141169#M13133</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2015-10-01T20:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: Labeling of decimals, rounding/padding using LabelLayer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/labeling-of-decimals-rounding-padding-using/m-p/141170#M13134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Aha!&amp;nbsp; That was it!&amp;nbsp; The labels round/pad correctly now.&amp;nbsp; Thanks for digging into this with me!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Oct 2015 20:06:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/labeling-of-decimals-rounding-padding-using/m-p/141170#M13134</guid>
      <dc:creator>ZoeZaloudek</dc:creator>
      <dc:date>2015-10-01T20:06:03Z</dc:date>
    </item>
  </channel>
</rss>

