AnsweredAssumed Answered

I am trying to use a function with visualizationVariables in a simple renderer

Question asked by mtwerling on Aug 24, 2017
Latest reply on Aug 25, 2017 by mtwerling

I have a function

var getMetricValue() {
   var result = // magic happens here to generate a value based on various factors
   return result;
}

 

and a simple renderer:

var myRenderer = new SimpleRenderer({
   symbol: new SimpleMarkerSymbol({
      size: 8,
      outline: {
         width: 0.5,
         color: 'black',
         style: 'solid'
      }
   }),
   visualVariables: [{
      type: 'color',
      field: getWellMetric,
      stops: [
      {value: 0, color: 'red'},
      {value: 100, color: 'blue'}
   ]
   }]

 

});

 

However, no matter what value I return from my function I get the same red symbol, even if I hard-code the return value to 100.  The documentation states that the field for a visualVariables can be a function.  If I use the same method for the field in a classBreaksRenderer then it works OK, but I want a continuous value renderer, not a breaks.  Am I using this capability wrong, or is there some other issue?

Outcomes