<?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: Map not displaying renderer after adding classbreakrenderer in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-not-displaying-renderer-after-adding/m-p/1192266#M77921</link>
    <description>&lt;P&gt;The main problem with this is that in 4.x &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html" target="_self"&gt;FeatureLayers&lt;/A&gt;, you don't have direct access to the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html" target="_self"&gt;Graphic&lt;/A&gt; (i.e. feature) objects that are displayed on the map.&amp;nbsp; The features returned by &lt;A href="http://queryFeatures" target="_self"&gt;queryFeatures&lt;/A&gt; are a copy of the actual features, and so modifying them won't make any difference to the layer itself.&lt;/P&gt;&lt;P&gt;One of the best ways to accomplish what you're trying to do may be to query the features (as you're doing), but then set their &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html#symbol" target="_self"&gt;symbol&lt;/A&gt; property directly, and then add them to a separate &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GraphicsLayer.html" target="_self"&gt;GraphicsLayer&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Thu, 14 Jul 2022 17:00:53 GMT</pubDate>
    <dc:creator>JoelBennett</dc:creator>
    <dc:date>2022-07-14T17:00:53Z</dc:date>
    <item>
      <title>Map not displaying renderer after adding classbreakrenderer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-not-displaying-renderer-after-adding/m-p/1191793#M77911</link>
      <description>&lt;P&gt;I have tried to add a new field to existing feature layer and used random value generator to append those attributes on the map. Looks like after adding renderer only legend appears on the map with feature layer empty. Support needed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;     const map = new Map({
        basemap: "satellite",
      });
     const myFeatureLayer = new FeatureLayer({
        url: url,
        opacity: 0.8,
        outFields: ["*"],
      });
     map.add(myFeatureLayer);
     var tempObj = new Field({
          alias: 'RISK',
          name: 'RISK',
          type: 'integer'
        });

        myFeatureLayer.fields.push(tempObj);
        const queryNew = myFeatureLayer.createQuery();
        queryNew.spatialRelationship = "intersects";
        queryNew.returnQueryGeometry = true;
        var randArr = [];
        for (var i = 0; i &amp;lt; 756; i++) {
            randArr[i] = (Math.floor(Math.random() * 100) + 1);
        }
        myFeatureLayer.queryFeatures(queryNew).then((results) =&amp;gt; {
          results.features.map((data, index) =&amp;gt; {
            data.attributes.RISK = randArr[index]
          })
          var renderer = new ClassBreaksRenderer({
            field: "RISK",
          });

          renderer.addClassBreakInfo({ minValue:0, maxValue:10, symbol:new SimpleFillSymbol({
            color: new Color([56, 168, 0, 0.5]),
            outline: {
              width: 0.5,
              color: [50, 50, 50, 0.6]
            }
          })});
          renderer.addClassBreakInfo({ minValue:11, maxValue:30, symbol:new SimpleFillSymbol({
            color: new Color([139, 209, 0, 0.5]),
            outline: {
              width: 0.5,
              color: [50, 50, 50, 0.6]
            }
          })});
          renderer.addClassBreakInfo({ minValue:31, maxValue:50, symbol:new SimpleFillSymbol({
            color: new Color([255, 255, 0, 0.5]),
            outline: {
              width: 0.5,
              color: [50, 50, 50, 0.6]
            }
          })});
          renderer.addClassBreakInfo({minValue:51, maxValue:90, symbol:new SimpleFillSymbol({
            color: new Color([255, 128, 0, 0.5  ]),
            outline: {
              width: 0.5,
              color: [50, 50, 50, 0.6]
            }
          })});

          myFeatureLayer.renderer = renderer;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2022-07-13 at 5.19.45 pm.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/45778i24DBD18CB841E66E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2022-07-13 at 5.19.45 pm.png" alt="Screen Shot 2022-07-13 at 5.19.45 pm.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2022 07:21:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-not-displaying-renderer-after-adding/m-p/1191793#M77911</guid>
      <dc:creator>SriharshaK</dc:creator>
      <dc:date>2022-07-13T07:21:31Z</dc:date>
    </item>
    <item>
      <title>Re: Map not displaying renderer after adding classbreakrenderer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-not-displaying-renderer-after-adding/m-p/1192266#M77921</link>
      <description>&lt;P&gt;The main problem with this is that in 4.x &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html" target="_self"&gt;FeatureLayers&lt;/A&gt;, you don't have direct access to the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html" target="_self"&gt;Graphic&lt;/A&gt; (i.e. feature) objects that are displayed on the map.&amp;nbsp; The features returned by &lt;A href="http://queryFeatures" target="_self"&gt;queryFeatures&lt;/A&gt; are a copy of the actual features, and so modifying them won't make any difference to the layer itself.&lt;/P&gt;&lt;P&gt;One of the best ways to accomplish what you're trying to do may be to query the features (as you're doing), but then set their &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html#symbol" target="_self"&gt;symbol&lt;/A&gt; property directly, and then add them to a separate &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GraphicsLayer.html" target="_self"&gt;GraphicsLayer&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2022 17:00:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-not-displaying-renderer-after-adding/m-p/1192266#M77921</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2022-07-14T17:00:53Z</dc:date>
    </item>
  </channel>
</rss>

