<?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: Changing labeling field for LabelLayer (JavaScript) in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-labeling-field-for-labellayer-javascript/m-p/474391#M43988</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;​ looks like a documentation bug - we'll get it fixed. Our labelling logic only supports a combination of attribute fields and simple text. Honestly our Label documentation is a bit confusing right now because a few things changed in recent releases that didn't make it into the doc in a clear way. So we are working on cleaning up the doc for labeling and hope its all much clearer at the next release. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 01 Oct 2015 17:00:03 GMT</pubDate>
    <dc:creator>KellyHutchins</dc:creator>
    <dc:date>2015-10-01T17:00:03Z</dc:date>
    <item>
      <title>Changing labeling field for LabelLayer (JavaScript)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-labeling-field-for-labellayer-javascript/m-p/474382#M43979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So – I have a web map that I’ve made from scratch using the ArcGIS API for Javascript.&amp;nbsp; In this web map I have multiple feature layers (all polygons) that have multiple numeric fields.&amp;nbsp; Users have the ability to choose what they want to see (in essence, choosing a feature layer and field combination) using dropdowns and radio buttons.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have figured out how to change the symbology and labels of the polygons shown at any given time.&amp;nbsp; My problem is with the Label Layer.&amp;nbsp; The way I have my code written, every time the user changes an option, a new feature layer is added to the Label Layer.&amp;nbsp; While this ensures that the correct labels are shown, after about a dozen option changes, performance really takes a hit and the view in the web map is glacially slow to update.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to just change the field (of the Feature Layer) that the Label Layer is showing without having to add a new feature layer to the Label Layer each time?&amp;nbsp; I’ve poked around in the documentation for LabelLayer but haven’t found what I’m looking for.&amp;nbsp; I feel like I’m just missing something obvious here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the one line that adds the feature layer (the variables lLayer, fLayer, labelRenderer, and field are all calculated before here).&amp;nbsp; If I comment out this line, everything runs great, but there are no labels.&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14431141179184949" data-renderedposition="323_8_912_16" jivemacro_uid="_14431141179184949"&gt;&lt;P&gt;lLayer.addFeatureLayer(fLayer, labelRenderer, ("{" + field + "}"));&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Sep 2015 17:06:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-labeling-field-for-labellayer-javascript/m-p/474382#M43979</guid>
      <dc:creator>ZoeZaloudek</dc:creator>
      <dc:date>2015-09-24T17:06:11Z</dc:date>
    </item>
    <item>
      <title>Re: Changing labeling field for LabelLayer (JavaScript)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-labeling-field-for-labellayer-javascript/m-p/474383#M43980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Zoe,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;looking at the documentation I think you are right, it looks like you will have to remove the label layer and add a new one once you would like to change the label field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Sep 2015 17:37:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-labeling-field-for-labellayer-javascript/m-p/474383#M43980</guid>
      <dc:creator>TimWitt2</dc:creator>
      <dc:date>2015-09-24T17:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: Changing labeling field for LabelLayer (JavaScript)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-labeling-field-for-labellayer-javascript/m-p/474384#M43981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You know what, that did the trick.&amp;nbsp; Maybe not the most elegant solution, I'm still open to other ideas, but right now this works so I'm running with it.&amp;nbsp; Just had to add a few lines of code around my addFeatureLayer line that I'd posted above.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;map.removeLayer(lLayer);
lLayer = new LabelLayer('layerlabel','STATIC');
lLayer.minScale = 10000000;
lLayer.addFeatureLayer(fLayer, labelRenderer, ("{" + field + "}"));
map.addLayer(lLayer);&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:58:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-labeling-field-for-labellayer-javascript/m-p/474384#M43981</guid>
      <dc:creator>ZoeZaloudek</dc:creator>
      <dc:date>2021-12-11T20:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: Changing labeling field for LabelLayer (JavaScript)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-labeling-field-for-labellayer-javascript/m-p/474385#M43982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Glad I could help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would be nice to have a function to change any parameter of the label layer and then redraw it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Sep 2015 19:30:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-labeling-field-for-labellayer-javascript/m-p/474385#M43982</guid>
      <dc:creator>TimWitt2</dc:creator>
      <dc:date>2015-09-24T19:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: Changing labeling field for LabelLayer (JavaScript)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-labeling-field-for-labellayer-javascript/m-p/474386#M43983</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;​&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can do this using LabelClass. Here's an example that shows how to create a new label class and apply it to the layer. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://jsbin.com/kekenuvuho/edit?html,css,js,output" title="http://jsbin.com/kekenuvuho/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>Wed, 30 Sep 2015 17:42:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-labeling-field-for-labellayer-javascript/m-p/474386#M43983</guid>
      <dc:creator>KellyHutchins</dc:creator>
      <dc:date>2015-09-30T17:42:21Z</dc:date>
    </item>
    <item>
      <title>Re: Changing labeling field for LabelLayer (JavaScript)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-labeling-field-for-labellayer-javascript/m-p/474387#M43984</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/2525"&gt;Kelly Hutchins&lt;/A&gt;​&lt;/P&gt;&lt;P&gt;The documentation reads like you can have a stacked label expression, but I don't get how this fits into your example:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pln" style="color: #595959;"&gt;labelClass&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #595959;"&gt;labelExpression &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #666600;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d;"&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="str"&gt;'[STATE_NAME] CONCAT NEWLINE CONCAT "Population: " CONCAT [POP2007]'&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you construct the LabelClass, you use labelExpressionInfo, which encompasses not only the labelExpression, but also formatting?&amp;nbsp; I'm having a hard time understanding the Help here.&amp;nbsp; It seems like there is a lot of potential here, but almost no examples or documentation to follow.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; I tried modifying your example to &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var labels = new LabelClass({&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp; labelExpressionInfo: {"value": "{Name}"}&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;&amp;nbsp;&amp;nbsp; });&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; labels.labelExpression = '[Name] CONCAT NEWLINE CONCAT [Magnitude]'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; but just ended up with nothing at all for my labels.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Oct 2015 13:46:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-labeling-field-for-labellayer-javascript/m-p/474387#M43984</guid>
      <dc:creator>TracySchloss</dc:creator>
      <dc:date>2015-10-01T13:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: Changing labeling field for LabelLayer (JavaScript)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-labeling-field-for-labellayer-javascript/m-p/474388#M43985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah, I see - use LabelClass &lt;EM&gt;instead of&lt;/EM&gt; LabelLayer.&amp;nbsp; I think I may have initially blown off LabelClass since the documentation seems to be for ArcGISDynamicMapServiceLayer instead of FeatureLayer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The example is very helpful, I got LabelClass to work with the FeatureLayer in my web map pretty quickly.&amp;nbsp; Thanks! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure if it's possible to mark two answers as correct in the forums (since Tim's suggestion worked as well)...&amp;nbsp; But I'm definitely marking this as helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Oct 2015 15:50:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-labeling-field-for-labellayer-javascript/m-p/474388#M43985</guid>
      <dc:creator>ZoeZaloudek</dc:creator>
      <dc:date>2015-10-01T15:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: Changing labeling field for LabelLayer (JavaScript)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-labeling-field-for-labellayer-javascript/m-p/474389#M43986</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;​ I don't think we support multi line labels. Can you link to the doc that says we do? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Oct 2015 16:37:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-labeling-field-for-labellayer-javascript/m-p/474389#M43986</guid>
      <dc:creator>KellyHutchins</dc:creator>
      <dc:date>2015-10-01T16:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: Changing labeling field for LabelLayer (JavaScript)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-labeling-field-for-labellayer-javascript/m-p/474390#M43987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's in the labelClass API reference under the Property Details for labelExpression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/jsapi/labelclass-amd.html" title="https://developers.arcgis.com/javascript/jsapi/labelclass-amd.html"&gt;LabelClass | API Reference | ArcGIS API for JavaScript&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At first I thought it was one of those instances that&amp;nbsp; it was supported in REST only but not in the JS API,&amp;nbsp; The API documentation references Labeling objects&amp;nbsp; &lt;A href="http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r3000001m1000000" title="http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r3000001m1000000"&gt;ArcGIS REST API&lt;/A&gt;&amp;nbsp; so that example is shown in both places.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it's not, I guess this is something else to clarify in the help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Oct 2015 16:50:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-labeling-field-for-labellayer-javascript/m-p/474390#M43987</guid>
      <dc:creator>TracySchloss</dc:creator>
      <dc:date>2015-10-01T16:50:43Z</dc:date>
    </item>
    <item>
      <title>Re: Changing labeling field for LabelLayer (JavaScript)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-labeling-field-for-labellayer-javascript/m-p/474391#M43988</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;​ looks like a documentation bug - we'll get it fixed. Our labelling logic only supports a combination of attribute fields and simple text. Honestly our Label documentation is a bit confusing right now because a few things changed in recent releases that didn't make it into the doc in a clear way. So we are working on cleaning up the doc for labeling and hope its all much clearer at the next release. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Oct 2015 17:00:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-labeling-field-for-labellayer-javascript/m-p/474391#M43988</guid>
      <dc:creator>KellyHutchins</dc:creator>
      <dc:date>2015-10-01T17:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: Changing labeling field for LabelLayer (JavaScript)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-labeling-field-for-labellayer-javascript/m-p/474392#M43989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The way it's written now, I feel like there is some functionality barely documented at all, and other things documented that don't work.&amp;nbsp; I know it's not a fancy new widget, but labeling is still a key element to a map and it should be better documented than it is. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Oct 2015 17:06:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/changing-labeling-field-for-labellayer-javascript/m-p/474392#M43989</guid>
      <dc:creator>TracySchloss</dc:creator>
      <dc:date>2015-10-01T17:06:00Z</dc:date>
    </item>
  </channel>
</rss>

