<?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: SVG symbol (or similar) in labels using Arcade in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svg-symbol-or-similar-in-labels-using-arcade/m-p/1270530#M80629</link>
    <description>&lt;P&gt;Thanks for the reply&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/507049"&gt;@Sage_Wall&lt;/a&gt;.&amp;nbsp;I created two separate label classes as suggested and I am able to have the up/down arrow and the text but they do not align correctly. I think I created it correctly as you suggested. Below is an examle of the output and my code snippet used.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="julian_svcs_0-1679507140137.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/65989iEE4F3618EFD7D057/image-size/medium?v=v2&amp;amp;px=400" role="button" title="julian_svcs_0-1679507140137.png" alt="julian_svcs_0-1679507140137.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const nameArcadeArrows = `
    var diff = $feature.voltr_2028 - $feature.voltr_2016;
    var arrow = '';
    IIf(diff &amp;gt; 0, '\ue609', '\ue608');
  `;

const nameArcadeText = `
    var diff = $feature.voltr_2028 - $feature.voltr_2016;
    IIf(diff &amp;gt; 0, diff, diff*-1);
  `;

const nameClassArrow = {
  labelExpressionInfo: {
    expression: nameArcadeArrows
  },
  symbol: {
    type: "text",
    color: "yellow",
    font: {
      family: "CalciteWebCoreIcons",
      size: 14,
    },
    haloColor: "gray",
    haloSize: 1.5,
  },
};

const nameClassText = {
  labelExpressionInfo: {
    expression: nameArcadeText
  },
  symbol: {
    type: "text",
    color: "yellow",
    font: {
      family: "Arial",
      size: 14,
    },
    haloColor: "gray",
    haloSize: 1.5,
  },
};

const featurelayer_line = new FeatureLayer({
  url: "https://[domain]/arcgis/rest/services/[service]/MapServer/5",
  title: "Difference between " + reference_year + " and " + comparison_year,
  renderer: linkRenderer,
  labelingInfo: [nameClassArrow, nameClassText],
  outFields: ["voltr_" + reference_year, "voltr_" + comparison_year],
  popupTemplate: popupTemplate,
  visible: true
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks once again.&lt;/P&gt;</description>
    <pubDate>Wed, 22 Mar 2023 17:48:06 GMT</pubDate>
    <dc:creator>julian_svcs</dc:creator>
    <dc:date>2023-03-22T17:48:06Z</dc:date>
    <item>
      <title>SVG symbol (or similar) in labels using Arcade</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svg-symbol-or-similar-in-labels-using-arcade/m-p/1270205#M80615</link>
      <description>&lt;P&gt;I have both positive and negative numbers and I would like to label my feature layer using either an up or down arrow. I am able to add this in the popup (see screenshot below) with an svg image, but this does not port over to the Arcade expression for labels.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea if this is possible with labels?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="julian_svcs_0-1679452475450.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/65901i3AB64FBB3E161FDC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="julian_svcs_0-1679452475450.png" alt="julian_svcs_0-1679452475450.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="julian_svcs_1-1679452494513.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/65902i26019173A2604AE8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="julian_svcs_1-1679452494513.png" alt="julian_svcs_1-1679452494513.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Code snippet used for the popup:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const upArrow = '&amp;lt;svg width="16" height="16" &amp;gt;&amp;lt;polygon points="14.14 7.07 7.07 0 0 7.07 4.07 7.07 4.07 16 10.07 16 10.07 7.07 14.14 7.07" /&amp;gt;&amp;lt;/svg&amp;gt;';
const downArrow = '&amp;lt;svg width="16" height="16"&amp;gt;&amp;lt;polygon points="0 8.93 7.07 16 14.14 8.93 10.07 8.93 10.07 0 4.07 0 4.07 8.93 0 8.93" /&amp;gt;&amp;lt;/svg&amp;gt;';
const diff =
      Math.round(feature.graphic.attributes[comparison_year_field]) -
      Math.round(feature.graphic.attributes[reference_year_field]);
const arrow = diff &amp;gt; 0 ? upArrow : downArrow;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 02:38:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svg-symbol-or-similar-in-labels-using-arcade/m-p/1270205#M80615</guid>
      <dc:creator>julian_svcs</dc:creator>
      <dc:date>2023-03-22T02:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: SVG symbol (or similar) in labels using Arcade</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svg-symbol-or-similar-in-labels-using-arcade/m-p/1270291#M80616</link>
      <description>&lt;P&gt;The Esri icon font can be used in labels.&amp;nbsp; You might need to create two label classes, one for the arrow icons and a second label class for the text or numbers using a standard font.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/esri-icon-font/#using-the-esri-icon-fonts-as-a-label" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/esri-icon-font/#using-the-esri-icon-fonts-as-a-label&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const skyConditionsExpression = `
  IIf(Find( 'Clear', $feature.SKY_CONDTN ) &amp;gt;= 0, '\ue64e', '\ue679');
`;

const clearSkyConditionLabelClass = {
  labelExpressionInfo: {
    expression: skyConditionsExpression,
  },
  labelPlacement: "above-left",
  minScale: referenceScale,
  symbol: {
    type: "text",
    color: "yellow",
    font: {
      family: "CalciteWebCoreIcons",
      size: 14,
    },
    haloColor: "gray",
    haloSize: 1.5,
  },
  where: `SKY_CONDTN LIKE '%Clear%'`,
};

const cloudySkyConditionLabelClass = {
  labelExpressionInfo: {
    expression: skyConditionsExpression,
  },
  labelPlacement: "above-left",
  minScale: referenceScale,
  symbol: {
    type: "text",
    color: "gray",
    font: {
      family: "CalciteWebCoreIcons",
      size: 14,
    },
    haloColor: "white",
    haloSize: 1.5,
  },
  where: `SKY_CONDTN NOT LIKE '%Clear%'`,
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 11:22:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svg-symbol-or-similar-in-labels-using-arcade/m-p/1270291#M80616</guid>
      <dc:creator>Sage_Wall</dc:creator>
      <dc:date>2023-03-22T11:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: SVG symbol (or similar) in labels using Arcade</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svg-symbol-or-similar-in-labels-using-arcade/m-p/1270530#M80629</link>
      <description>&lt;P&gt;Thanks for the reply&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/507049"&gt;@Sage_Wall&lt;/a&gt;.&amp;nbsp;I created two separate label classes as suggested and I am able to have the up/down arrow and the text but they do not align correctly. I think I created it correctly as you suggested. Below is an examle of the output and my code snippet used.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="julian_svcs_0-1679507140137.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/65989iEE4F3618EFD7D057/image-size/medium?v=v2&amp;amp;px=400" role="button" title="julian_svcs_0-1679507140137.png" alt="julian_svcs_0-1679507140137.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const nameArcadeArrows = `
    var diff = $feature.voltr_2028 - $feature.voltr_2016;
    var arrow = '';
    IIf(diff &amp;gt; 0, '\ue609', '\ue608');
  `;

const nameArcadeText = `
    var diff = $feature.voltr_2028 - $feature.voltr_2016;
    IIf(diff &amp;gt; 0, diff, diff*-1);
  `;

const nameClassArrow = {
  labelExpressionInfo: {
    expression: nameArcadeArrows
  },
  symbol: {
    type: "text",
    color: "yellow",
    font: {
      family: "CalciteWebCoreIcons",
      size: 14,
    },
    haloColor: "gray",
    haloSize: 1.5,
  },
};

const nameClassText = {
  labelExpressionInfo: {
    expression: nameArcadeText
  },
  symbol: {
    type: "text",
    color: "yellow",
    font: {
      family: "Arial",
      size: 14,
    },
    haloColor: "gray",
    haloSize: 1.5,
  },
};

const featurelayer_line = new FeatureLayer({
  url: "https://[domain]/arcgis/rest/services/[service]/MapServer/5",
  title: "Difference between " + reference_year + " and " + comparison_year,
  renderer: linkRenderer,
  labelingInfo: [nameClassArrow, nameClassText],
  outFields: ["voltr_" + reference_year, "voltr_" + comparison_year],
  popupTemplate: popupTemplate,
  visible: true
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks once again.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 17:48:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svg-symbol-or-similar-in-labels-using-arcade/m-p/1270530#M80629</guid>
      <dc:creator>julian_svcs</dc:creator>
      <dc:date>2023-03-22T17:48:06Z</dc:date>
    </item>
    <item>
      <title>Re: SVG symbol (or similar) in labels using Arcade</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svg-symbol-or-similar-in-labels-using-arcade/m-p/1270599#M80633</link>
      <description>&lt;P&gt;Dang, in my head I had envisioned point features where you could set the labelPlacement property to different values for the two classes.&amp;nbsp; With polyline feature layers it looks like there isn't as much control over the position of the labels, the only &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html#labelPlacement" target="_self"&gt;labelPlacement&lt;/A&gt; option available for 2D polylines is `center-along`.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 20:01:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/svg-symbol-or-similar-in-labels-using-arcade/m-p/1270599#M80633</guid>
      <dc:creator>Sage_Wall</dc:creator>
      <dc:date>2023-03-22T20:01:23Z</dc:date>
    </item>
  </channel>
</rss>

