AnsweredAssumed Answered

Feature Layer opacity (visual variable) issue

Question asked by oconnorct1 on Oct 11, 2017
Latest reply on Oct 11, 2017 by rscheitlin

ArcGIS API for JavaScript Sandbox 

 

Been playing with this sandbox. While the opacity filter works in this example, in mine it does not. I pretty much copy pasted the render feature and on first load the opacity feature works, but I start playing with the year with the slider, the opacity feature no longer works but the colors do (all parcels show up). Is there anyone I can talk to, to discuss this feature or anything I should try to change?

 

The code I use is:

 

createRenderer(year: number) {
return {
type: "simple",
symbol: {
type: "simple-fill",
color: "rgb(0, 0, 0)",
outline: null
},
visualVariables: [{
type: "color",
field: "BUILT_YR",
legendOptions: {
title: "Built:"
},
stops: [{
value: year,
color: "#0ff",
label: "in " + Math.floor(year)
}, {
value: year - 10,
color: "#f0f",
label: "in " + (Math.floor(year) - 20)
}, {
value: year - 50,
color: "#404",
label: "before " + (Math.floor(year) - 50)
}]
}, {
type: "opacity",
field: "BUILT_YR",
stops: [{
opacity: 0,
value: year + 1
}, {
opacity: 1,
value: year
}],
legendOptions: {
showLegend: false
}
}]
};

 

 

handleChange(event: Event) { // $FlowFixMe
let year = event.target.value;
const { fl } = this.state;
fl.renderer = this.createRenderer(year);
this.setState({ year });
}

Outcomes