<?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 Legend for MapImageLayer using Class Breaks Renderer is getting reversed in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/legend-for-mapimagelayer-using-class-breaks/m-p/1237133#M79526</link>
    <description>&lt;P&gt;Hi, I am using ArcGIS API for JavaScript 4.x in my app. A MapImageLayer has been added on to the map and it is loaded properly in the app. Initially, the legend shows the categorized classes from least to most for this service. &amp;nbsp;On clicking anywhere on the map, the order of categorized classes is getting reversed in the legend.&lt;/P&gt;&lt;P&gt;How to prevent this?&lt;/P&gt;&lt;P&gt;For your information, the service uses Class Breaks Renderer to classify it into different classes.&lt;/P&gt;&lt;P&gt;Here is a sample code demonstrating how it has been added:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;        const layer = new MapImageLayer({
          portalItem: {
            id: "73c67b3d082b4ef58c3c8ce14add8c9d",
          },
          sublayers: [
            {
              id: 3,
              popupEnabled: true,
              definitionExpression: "TallShrubCC&amp;gt;0",
              popupTemplate: {
                title: "Tall Shrub Canopy Cover: {Map_Group}",
                content: [
                  {
                    type: "fields",
                    fieldInfos: [
                      {
                        fieldName: "Map_Group",
                        visible: true,
                        label: "Map_Group",
                      },
                      {
                        fieldName: "Dominance_Type",
                        visible: true,
                        label: "Dominance_Type",
                      },
                    ],
                  },
                ],
                overwriteActions: true,
              },
            },
          ],
        });

        /*****************************************************************
         * Add the layer to a map
         *****************************************************************/
        const map = new Map({
          basemap: "topo-vector",
          layers: [layer],
        });

        const view = new MapView({
          container: "viewDiv",
          map: map,
          extent: {
            xmax: -16725224.278226044,
            xmin: -16789584.256042186,
            ymax: 8432236.729622887,
            ymin: 8383240.594492071,
            spatialReference: 102100,
          },
        });
        const legend = new Legend({
          view: view,
        });
        view.ui.add(legend, "bottom-right");&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 02 Dec 2022 04:45:24 GMT</pubDate>
    <dc:creator>LakshanaRajendran</dc:creator>
    <dc:date>2022-12-02T04:45:24Z</dc:date>
    <item>
      <title>Legend for MapImageLayer using Class Breaks Renderer is getting reversed</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/legend-for-mapimagelayer-using-class-breaks/m-p/1237133#M79526</link>
      <description>&lt;P&gt;Hi, I am using ArcGIS API for JavaScript 4.x in my app. A MapImageLayer has been added on to the map and it is loaded properly in the app. Initially, the legend shows the categorized classes from least to most for this service. &amp;nbsp;On clicking anywhere on the map, the order of categorized classes is getting reversed in the legend.&lt;/P&gt;&lt;P&gt;How to prevent this?&lt;/P&gt;&lt;P&gt;For your information, the service uses Class Breaks Renderer to classify it into different classes.&lt;/P&gt;&lt;P&gt;Here is a sample code demonstrating how it has been added:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;        const layer = new MapImageLayer({
          portalItem: {
            id: "73c67b3d082b4ef58c3c8ce14add8c9d",
          },
          sublayers: [
            {
              id: 3,
              popupEnabled: true,
              definitionExpression: "TallShrubCC&amp;gt;0",
              popupTemplate: {
                title: "Tall Shrub Canopy Cover: {Map_Group}",
                content: [
                  {
                    type: "fields",
                    fieldInfos: [
                      {
                        fieldName: "Map_Group",
                        visible: true,
                        label: "Map_Group",
                      },
                      {
                        fieldName: "Dominance_Type",
                        visible: true,
                        label: "Dominance_Type",
                      },
                    ],
                  },
                ],
                overwriteActions: true,
              },
            },
          ],
        });

        /*****************************************************************
         * Add the layer to a map
         *****************************************************************/
        const map = new Map({
          basemap: "topo-vector",
          layers: [layer],
        });

        const view = new MapView({
          container: "viewDiv",
          map: map,
          extent: {
            xmax: -16725224.278226044,
            xmin: -16789584.256042186,
            ymax: 8432236.729622887,
            ymin: 8383240.594492071,
            spatialReference: 102100,
          },
        });
        const legend = new Legend({
          view: view,
        });
        view.ui.add(legend, "bottom-right");&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2022 04:45:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/legend-for-mapimagelayer-using-class-breaks/m-p/1237133#M79526</guid>
      <dc:creator>LakshanaRajendran</dc:creator>
      <dc:date>2022-12-02T04:45:24Z</dc:date>
    </item>
    <item>
      <title>Re: Legend for MapImageLayer using Class Breaks Renderer is getting reversed</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/legend-for-mapimagelayer-using-class-breaks/m-p/1237419#M79541</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/604013"&gt;@LakshanaRajendran&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thanks so much for taking the time to post here.&amp;nbsp; I can replicate the behavior of the class breaks reversing order in the Legend after clicking on the map.&amp;nbsp; It seems to only happen when popups are enabled.&amp;nbsp; I'll submit it as a bug, this is unexpected behavior.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2022 21:34:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/legend-for-mapimagelayer-using-class-breaks/m-p/1237419#M79541</guid>
      <dc:creator>Sage_Wall</dc:creator>
      <dc:date>2022-12-02T21:34:41Z</dc:date>
    </item>
  </channel>
</rss>

