AnsweredAssumed Answered

Problem with UniqueValueRenderer

Question asked by rolandoflorez17 on Dec 21, 2016
Latest reply on Dec 27, 2016 by thejus.kambi

I have a problem with this render.
I'm trying to diferenciate the posible values from a domain field (with respective coded values). The render receive a symbol and the field. And then I'm going code value by code value (into foreach) assigning diferents color and label.
But the result is that the render is drawing all codedvalues with the last color assigned.

uniqueValRender: function () {
   var randomColor;
   var defaultSymbol = this.getBaseSymbol();;;
   var renderer = new UniqueValueRenderer(defaultSymbol, this.parameters.field);
   var codedValues = this.parameters.domainObject.codedValues;
   var color;

   arrayUtils.forEach(codedValues, function (value) {;
      randomColor = '#' + Math.floor(Math.random() * 16777215).toString(16);
      color = new Color(randomColor);
      /*color.a = 0.5;*/;;;
      value: value.code,
      symbol: defaultSymbol.setColor(color),
      description: ""

   var optionsArray = [];
   var drawingOptions = new LayerDrawingOptions();
   drawingOptions.renderer = renderer;
   // set the drawing options for the relevant layer
   // optionsArray index corresponds to layer index in the map service
   optionsArray[this.parameters.idPos] = drawingOptions;
   if (!this.legend) {