Select to view content in your preferred language

Generate Renderer issue

2940
10
Jump to solution
11-14-2012 11:34 AM
SamirGambhir
Frequent Contributor
Hi,
I am trying to generate a class breaks renderer using generateRenderer task, but the renderer object is not being returned. I am using ArcGIS Server 10.1 with Javascript API v=2.8. I am using the following esri example (Generate Renderer) to build my code.
function renderIndicator(ind, num, url) {  var classDef = new esri.tasks.ClassBreaksDefinition();  classDef.breakCount = num; //number of breaks  classDef.classificationField = ind; //field name  classDef.classificationMethod = "natural-breaks";  classDef.baseSymbol = symbol;          var colorRamp = new esri.tasks.AlgorithmicColorRamp();  colorRamp.fromColor = new dojo.colorFromHex('#ffff80');  colorRamp.toColor = new dojo.colorFromHex('#6B0000');  colorRamp.algorithm = "cie-lab";  // options are:  "cie-lab", "hsv", "lab-lch"  classDef.colorRamp = colorRamp;          var params = new esri.tasks.GenerateRendererParameters();  params.classificationDefinition = classDef;  var generateRenderer = new esri.tasks.GenerateRendererTask(url); //url of a feature layer  generateRenderer.execute(params);  dojo.connect(generateRenderer, function(renderer) {   return renderer;  }); }

The returned 'renderer' object is needed in another function to display features and generate a legend. It seems that dojo.connect is not working. What am I missing here?

Thanks
Samir
0 Kudos
10 Replies
derekswingley1
Deactivated User
Hi Derek,
I managed to modify my application to work with 3.2. Thanks for your help fixing the renderer issue.


Glad you were able to upgrade and that I was able to help.


Now I am trying to set up the legend but it is not working. The code below shows the legend only when the "Map it" button is clicked twice. I added a global variable (legendDijit), added CSS code as below and added this small piece of code to your existing code.


This is a new, different issue. Please start a new thread.

When you do post a new thread, please include a complete code sample that reproduces the issue. Similar to how in one of my previous posts in this thread I took the generate renderer sample and modified it to match what you were attempting to do, please take one of our samples and try to reproduce the issue you're seeing.
0 Kudos