AnsweredAssumed Answered

How to use setVisualVariables instead of setColorInfo in a SimpleRenderer

Question asked by kenbuja Champion on Aug 29, 2017
Latest reply on Aug 30, 2017 by kenbuja

The setColorInfo method for the SimpleRenderer was deprecated at as v3.13. However, I can't seem to get the setVisualVariable method to create a color ramp.

 

Using this sample, I've tried two different ways:

renderer.setVisualVariables({
  type: "colorInfo",
  field: "M086_07",
  minDataValue: 0,
  maxDataValue: 100,
  colors: [
    new Color([255, 255, 255]),
    new Color([127, 127, 0])
  ]
});

 

and

renderer.setVisualVariables({
  type: "colorInfo",
  field: "M086_07",
  stops: [
    {
      value: 0,
      color: new Color([255, 255, 255]),
      label: "0"
    },
    {
      value: 100,
      color: new Color([127, 127, 0]),
      label: "100"
    }
  ]
});

but neither of them work. I want to set the stops so that 0 is empty, but values 1-10 use a color ramp.

 

What is the correct way to use setVisualVariables?

Outcomes