AnsweredAssumed Answered

modifying the legend widget and ImageryLayer

Question asked by Liz.Eidsness_aafc on Jul 17, 2019
Latest reply on Jul 23, 2019 by Liz.Eidsness_aafc

Problem: I have a situation where I have a raster from an ImageService.  I have applied a client side colormap.  I'd like the legend to reflect the colormap.  I'd like to know if my approach is ok.  When I put all the pieces together they fail, so I don't know if it's ok, or a bug.  

 

Also: In investigating this, I think I have found a bug or something. (I've e-mailed ESRI)

 

I have figured out how to modify the legend by changing activeLayerInfos / legendElements object.  This works fine on a click event.  You'll see the labels for the first two legend items change on a click on the map.  https://codepen.io/lizeidsness/pen/GbVvKp

 

This is going to be a little piece of a big pie, so I'd like to hook it up to an event/watch that's appropriate, and I'm having trouble finding the right one.  I have tried this.  https://codepen.io/lizeidsness/pen/xvKpje

 

Seems to work - EXCEPT  not with my ImageryLayer.  It reverts when you do anything.  

https://codepen.io/lizeidsness/pen/zgOpBL It's using the click handler, to better isolate the events.  If you drag the map around, the changes stay.  If you zoom, they are gone.  I haven't even attempted to put this together with my custom renderer because it's not working well yet.

Outcomes