<?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 GenerateRendererTask does not create symbols in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/generaterenderertask-does-not-create-symbols/m-p/1153523#M76644</link>
    <description>&lt;P&gt;I am attempting to render a feature layer based on UniqueValueDefinition to show unique symbology for the unique values for a given field. When the field changes, I re-render the feature layer. My problem is that the unique values are shown but there are no symbols associated with the values. Why is&amp;nbsp;GenerateRendererTask&amp;nbsp; not generating symbols for the unique values? I've attached an image of the legend with the unique values whose symbols are missing. Javascript api version 3.39.&lt;/P&gt;&lt;P&gt;Edit: I used the layer at&amp;nbsp;"&lt;A href="https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/2" target="_blank"&gt;https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/2&lt;/A&gt;" to test and the symbols are shown. The only major difference between that layer and mine is&amp;nbsp;&lt;STRONG&gt;Can Modify Layer:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;true. Could that be causing the symbols not to show up in my application?&lt;/SPAN&gt;&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;define([
  'dojo/_base/declare',
  "dijit/_WidgetsInTemplateMixin",
  'jimu/BaseWidget',
  "esri/request",
  "dojo/_base/array",
  "esri/Color",
  "esri/tasks/UniqueValueDefinition",
  "esri/tasks/AlgorithmicColorRamp",
  "esri/layers/FeatureLayer",
  "esri/symbols/SimpleFillSymbol",
  "dojo/_base/lang",
  "dojo/on",
  "esri/tasks/GenerateRendererParameters",
  "esri/tasks/GenerateRendererTask",
  "esri/layers/LayerDrawingOptions",
  "esri/tasks/QueryTask",
  "esri/tasks/query",
  "esri/renderers/UniqueValueRenderer",
  "dijit/form/Select"
],
  function(declare, _WidgetsInTemplateMixin, BaseWidget,
    esriRequest, arrayUtils, Color,
    UniqueValueDefinition, AlgorithmicColorRamp,
    FeatureLayer, SimpleFillSymbol,
    lang, on, GenerateRendererParameters, GenerateRendererTask,LayerDrawingOptions,QueryTask,Query,UniqueValueRenderer ) {

      return declare([BaseWidget, _WidgetsInTemplateMixin], {

        baseClass: 'jimu-widget-aUV',
        currField: null,

        postCreate: function() {
          this.inherited(arguments);
        },

        startup: function() {
          this.own(on(this.selectField, "change", lang.hitch(this, this.onFieldChange)));
		var layerUrl="my service url";
          var landusePolygonLayer = new FeatureLayer(layerUrl, {
            id: "canada_Risk",
            mode: FeatureLayer.MODE_SNAPSHOT,
            outFields: ["*"]
          });
          this.map.addLayers([landusePolygonLayer]);
		  
          //fieldInfo		  
          var canadaFields = esriRequest({
            url:layerUrl,
            content:{
              f: "json"
            },
            callbackParamName : "callback"
          });
          console.log("fields", canadaFields)
          var fieldNames, fieldStore;
          canadaFields.then(lang.hitch(this, function(resp){
            var fields = [];
            arrayUtils.forEach(resp.fields,function(f){
              var foption = {
                value: f.name,
                label: f.alias
              };
              fields.push(foption);
            });
            this.selectField.addOption(fields);
          }), function(err){
            console.log("failed to get field names: ", err);
          });
        },

          onFieldChange: function (evt) {  	  			  			  
		
			  var colorRamp = new AlgorithmicColorRamp();
			  colorRamp.fromColor =  dojo.colorFromHex("#998ec3");//new Color.fromHex("#ffffcc");
			  colorRamp.toColor =  dojo.colorFromHex("#f1a340");//new Color.fromHex("#006837");
			  colorRamp.algorithm = "hsv"; // options are:  "cie-lab", "hsv", "lab-lch"	  
			 
			  var classDef = new UniqueValueDefinition();
		      classDef.attributeField = this.selectField.get('value');
			  classDef.type = "uniqueValueDef";
			  classDef.baseSymbol = new SimpleFillSymbol().setColor(new Color([255,0,0,0.5]));//new SimpleFillSymbol("solid", null, null);
			  classDef.ColorRamp = colorRamp;

			  var params = new GenerateRendererParameters();
			  params.classificationDefinition = classDef;					  
			  
			  var generateRenderer = new GenerateRendererTask("my service url");
			  generateRenderer.execute(params, lang.hitch(this, function(renderer){ 
							
				this.map.getLayer("canada_Risk").setRenderer(renderer);
				this.map.getLayer("canada_Risk").redraw();
				this.map.getLayer("canada_Risk").refresh();
			  }), lang.hitch(this, function(err){
				console.info(err);
          }));
        }
      });
    });&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;&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="UniqueValueError.PNG" style="width: 141px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/36291i77467804EAAE068D/image-size/large?v=v2&amp;amp;px=999" role="button" title="UniqueValueError.PNG" alt="UniqueValueError.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1104"&gt;@RobertScheitlin__GISP&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/204423"&gt;@ErwinSoekianto&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/3014"&gt;@MichaelBranscomb&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/95280"&gt;@JayantaPoddar&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/148663"&gt;@AlixVezina&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1126"&gt;@DerekLaw&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/44467"&gt;@KristianEkenes&lt;/a&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Mar 2022 20:48:03 GMT</pubDate>
    <dc:creator>KisakyeM</dc:creator>
    <dc:date>2022-03-14T20:48:03Z</dc:date>
    <item>
      <title>GenerateRendererTask does not create symbols</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/generaterenderertask-does-not-create-symbols/m-p/1153523#M76644</link>
      <description>&lt;P&gt;I am attempting to render a feature layer based on UniqueValueDefinition to show unique symbology for the unique values for a given field. When the field changes, I re-render the feature layer. My problem is that the unique values are shown but there are no symbols associated with the values. Why is&amp;nbsp;GenerateRendererTask&amp;nbsp; not generating symbols for the unique values? I've attached an image of the legend with the unique values whose symbols are missing. Javascript api version 3.39.&lt;/P&gt;&lt;P&gt;Edit: I used the layer at&amp;nbsp;"&lt;A href="https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/2" target="_blank"&gt;https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/2&lt;/A&gt;" to test and the symbols are shown. The only major difference between that layer and mine is&amp;nbsp;&lt;STRONG&gt;Can Modify Layer:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;true. Could that be causing the symbols not to show up in my application?&lt;/SPAN&gt;&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;define([
  'dojo/_base/declare',
  "dijit/_WidgetsInTemplateMixin",
  'jimu/BaseWidget',
  "esri/request",
  "dojo/_base/array",
  "esri/Color",
  "esri/tasks/UniqueValueDefinition",
  "esri/tasks/AlgorithmicColorRamp",
  "esri/layers/FeatureLayer",
  "esri/symbols/SimpleFillSymbol",
  "dojo/_base/lang",
  "dojo/on",
  "esri/tasks/GenerateRendererParameters",
  "esri/tasks/GenerateRendererTask",
  "esri/layers/LayerDrawingOptions",
  "esri/tasks/QueryTask",
  "esri/tasks/query",
  "esri/renderers/UniqueValueRenderer",
  "dijit/form/Select"
],
  function(declare, _WidgetsInTemplateMixin, BaseWidget,
    esriRequest, arrayUtils, Color,
    UniqueValueDefinition, AlgorithmicColorRamp,
    FeatureLayer, SimpleFillSymbol,
    lang, on, GenerateRendererParameters, GenerateRendererTask,LayerDrawingOptions,QueryTask,Query,UniqueValueRenderer ) {

      return declare([BaseWidget, _WidgetsInTemplateMixin], {

        baseClass: 'jimu-widget-aUV',
        currField: null,

        postCreate: function() {
          this.inherited(arguments);
        },

        startup: function() {
          this.own(on(this.selectField, "change", lang.hitch(this, this.onFieldChange)));
		var layerUrl="my service url";
          var landusePolygonLayer = new FeatureLayer(layerUrl, {
            id: "canada_Risk",
            mode: FeatureLayer.MODE_SNAPSHOT,
            outFields: ["*"]
          });
          this.map.addLayers([landusePolygonLayer]);
		  
          //fieldInfo		  
          var canadaFields = esriRequest({
            url:layerUrl,
            content:{
              f: "json"
            },
            callbackParamName : "callback"
          });
          console.log("fields", canadaFields)
          var fieldNames, fieldStore;
          canadaFields.then(lang.hitch(this, function(resp){
            var fields = [];
            arrayUtils.forEach(resp.fields,function(f){
              var foption = {
                value: f.name,
                label: f.alias
              };
              fields.push(foption);
            });
            this.selectField.addOption(fields);
          }), function(err){
            console.log("failed to get field names: ", err);
          });
        },

          onFieldChange: function (evt) {  	  			  			  
		
			  var colorRamp = new AlgorithmicColorRamp();
			  colorRamp.fromColor =  dojo.colorFromHex("#998ec3");//new Color.fromHex("#ffffcc");
			  colorRamp.toColor =  dojo.colorFromHex("#f1a340");//new Color.fromHex("#006837");
			  colorRamp.algorithm = "hsv"; // options are:  "cie-lab", "hsv", "lab-lch"	  
			 
			  var classDef = new UniqueValueDefinition();
		      classDef.attributeField = this.selectField.get('value');
			  classDef.type = "uniqueValueDef";
			  classDef.baseSymbol = new SimpleFillSymbol().setColor(new Color([255,0,0,0.5]));//new SimpleFillSymbol("solid", null, null);
			  classDef.ColorRamp = colorRamp;

			  var params = new GenerateRendererParameters();
			  params.classificationDefinition = classDef;					  
			  
			  var generateRenderer = new GenerateRendererTask("my service url");
			  generateRenderer.execute(params, lang.hitch(this, function(renderer){ 
							
				this.map.getLayer("canada_Risk").setRenderer(renderer);
				this.map.getLayer("canada_Risk").redraw();
				this.map.getLayer("canada_Risk").refresh();
			  }), lang.hitch(this, function(err){
				console.info(err);
          }));
        }
      });
    });&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;&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="UniqueValueError.PNG" style="width: 141px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/36291i77467804EAAE068D/image-size/large?v=v2&amp;amp;px=999" role="button" title="UniqueValueError.PNG" alt="UniqueValueError.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1104"&gt;@RobertScheitlin__GISP&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/204423"&gt;@ErwinSoekianto&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/3014"&gt;@MichaelBranscomb&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/95280"&gt;@JayantaPoddar&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/148663"&gt;@AlixVezina&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1126"&gt;@DerekLaw&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/44467"&gt;@KristianEkenes&lt;/a&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Mar 2022 20:48:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/generaterenderertask-does-not-create-symbols/m-p/1153523#M76644</guid>
      <dc:creator>KisakyeM</dc:creator>
      <dc:date>2022-03-14T20:48:03Z</dc:date>
    </item>
  </channel>
</rss>

