Feature Layer opacity (visual variable) issue

374
1
10-11-2017 01:26 AM
CraigOConnor
New Contributor

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 });
}

0 Kudos
1 Reply
RobertScheitlin__GISP
MVP Emeritus

Craig,

   The sandbox apps data spans over a 50 year period, does your data have that much of a span? If not then you will have to adjust the renderers stops.

0 Kudos