<?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 Format FeatureLayer label text in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/format-featurelayer-label-text/m-p/1209291#M78573</link>
    <description>&lt;P&gt;Using ArcGIS JS API 4.23.&lt;/P&gt;&lt;P&gt;I would like to dynamically format the labels of a FeatureLayer based on a set of rules. These rules would result in &lt;STRONG&gt;parts&lt;/STRONG&gt; of the label text being italicized.&lt;/P&gt;&lt;P&gt;Rules for parts of the text that &lt;STRONG&gt;should not&lt;/STRONG&gt; be italicized (just for example purposes):&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Text between single quotes, brackets, or parentheses&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Eg.:&amp;nbsp;&amp;nbsp;&lt;EM&gt;Abelia&lt;/EM&gt;&amp;nbsp;x&amp;nbsp;&lt;EM&gt;grandiflora&lt;/EM&gt;&amp;nbsp;[Hopleys™]&amp;nbsp;&lt;EM&gt;=&lt;/EM&gt;&amp;nbsp;'Abghop'&lt;/P&gt;&lt;P&gt;I was able to create the logic to format the text correctly in Javascript and apply it to the react components but would like to apply it to the labels as well.&lt;/P&gt;&lt;P&gt;My idea was to use Arcade Expression to recreate the logic I have in Javascript to format the label text based on its results but&amp;nbsp;I wasn't able to italicize &lt;STRONG&gt;partially&lt;/STRONG&gt; the text of the FeatureLayer labels.&lt;/P&gt;&lt;P&gt;I did some research and saw that you are able to do that in ArcGIS PRO using XML tags. Is there a way to do that or to achieve the same result using the JS API?&lt;/P&gt;</description>
    <pubDate>Fri, 02 Sep 2022 18:39:04 GMT</pubDate>
    <dc:creator>FabricioBezerra</dc:creator>
    <dc:date>2022-09-02T18:39:04Z</dc:date>
    <item>
      <title>Format FeatureLayer label text</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/format-featurelayer-label-text/m-p/1209291#M78573</link>
      <description>&lt;P&gt;Using ArcGIS JS API 4.23.&lt;/P&gt;&lt;P&gt;I would like to dynamically format the labels of a FeatureLayer based on a set of rules. These rules would result in &lt;STRONG&gt;parts&lt;/STRONG&gt; of the label text being italicized.&lt;/P&gt;&lt;P&gt;Rules for parts of the text that &lt;STRONG&gt;should not&lt;/STRONG&gt; be italicized (just for example purposes):&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Text between single quotes, brackets, or parentheses&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Eg.:&amp;nbsp;&amp;nbsp;&lt;EM&gt;Abelia&lt;/EM&gt;&amp;nbsp;x&amp;nbsp;&lt;EM&gt;grandiflora&lt;/EM&gt;&amp;nbsp;[Hopleys™]&amp;nbsp;&lt;EM&gt;=&lt;/EM&gt;&amp;nbsp;'Abghop'&lt;/P&gt;&lt;P&gt;I was able to create the logic to format the text correctly in Javascript and apply it to the react components but would like to apply it to the labels as well.&lt;/P&gt;&lt;P&gt;My idea was to use Arcade Expression to recreate the logic I have in Javascript to format the label text based on its results but&amp;nbsp;I wasn't able to italicize &lt;STRONG&gt;partially&lt;/STRONG&gt; the text of the FeatureLayer labels.&lt;/P&gt;&lt;P&gt;I did some research and saw that you are able to do that in ArcGIS PRO using XML tags. Is there a way to do that or to achieve the same result using the JS API?&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2022 18:39:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/format-featurelayer-label-text/m-p/1209291#M78573</guid>
      <dc:creator>FabricioBezerra</dc:creator>
      <dc:date>2022-09-02T18:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: Format FeatureLayer label text</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/format-featurelayer-label-text/m-p/1316475#M81882</link>
      <description>&lt;P&gt;Fabricio,&lt;/P&gt;&lt;P&gt;Did you find a solution to this? I am using an Arcade Expression to generate a list of species (common name, scientific name, and protection status) in JavaScript, but have not yet been able to figure out how to italicize just the species name.&lt;/P&gt;&lt;P&gt;Any insight you may have would be appreciated.&lt;/P&gt;&lt;P&gt;Ashley&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2023 15:40:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/format-featurelayer-label-text/m-p/1316475#M81882</guid>
      <dc:creator>AshleyPeters</dc:creator>
      <dc:date>2023-08-08T15:40:30Z</dc:date>
    </item>
    <item>
      <title>Re: Format FeatureLayer label text</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/format-featurelayer-label-text/m-p/1316501#M81884</link>
      <description>&lt;P&gt;Hi Ashley,&lt;/P&gt;&lt;P&gt;I’ve found a workaround for the problem. Not sure if it will work for you but it did for me.&lt;BR /&gt;I basically overlapped two LabelClass instances. One italic and the other non-italic using a monospaced font.&lt;BR /&gt;&lt;BR /&gt;Here are the steps I’ve followed to achieve the solution:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Set two different LabelClass instances to the labelingInfo property of the FeatureLayer.&lt;BR /&gt;- Use a monospaced font, which has every character (including the space) with the same width, for both LabelClass instances&lt;BR /&gt;- One instance will have italicized font&lt;BR /&gt;- The other instance will have the non-italicized font&lt;/LI&gt;&lt;LI&gt;Create the logic using Arcade Expression&lt;BR /&gt;- For the italicized label class instance, create the necessary logic to replace the non-italic parts of the label value with spaces&lt;BR /&gt;- For the non-italic label class instance, create the necessary logic to replace the italic parts of the label value with spaces&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Set &lt;/SPAN&gt;&lt;EM&gt;xoffset&lt;/EM&gt;&lt;SPAN&gt; and &lt;/SPAN&gt;&lt;EM&gt;yoffset&lt;/EM&gt;&lt;SPAN&gt; properties to overlap both LabelClass instances&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;BR /&gt;I've attached an image of the result.&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;BR /&gt;&lt;BR /&gt;Fabricio&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2023 16:44:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/format-featurelayer-label-text/m-p/1316501#M81884</guid>
      <dc:creator>FabricioBezerra</dc:creator>
      <dc:date>2023-08-08T16:44:57Z</dc:date>
    </item>
  </channel>
</rss>

