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?
Solved! Go to Solution.
Ken,
setVisualVariables is expecting an array.
renderer.setVisualVariables([{
type: "colorInfo",
field: "M086_07",
minDataValue: 0,
maxDataValue: 100,
colors: [
new Color([255, 255, 255]),
new Color([127, 127, 0])
]
}]);
Ken,
setVisualVariables is expecting an array.
renderer.setVisualVariables([{
type: "colorInfo",
field: "M086_07",
minDataValue: 0,
maxDataValue: 100,
colors: [
new Color([255, 255, 255]),
new Color([127, 127, 0])
]
}]);
Thanks Robert,
I overlooked that extra set of brackets.