Select to view content in your preferred language

Can legend stay visible even if the layer is off in JS API?

3883
3
05-13-2015 09:23 AM
FilipKrál
Frequent Contributor

Hello, I am writing a web application using ArcGIS JavaScript API (>=3.13) and I need the legend to stay on all the time even if the layer is off because other elements on the page use the same symbols. Is that possible?

If I read it right the documentation only describes how to override sensitivity to map scale.

What do you think would be other options for doing that?

Filip.

0 Kudos
3 Replies
TimWitt2
MVP Alum
RickeyFight
MVP Regular Contributor

Another option would be to add a jpeg of the legend and add that to the map. That is what I did here:

FilipKrál
Frequent Contributor

Hi, thanks for your responses.

Tim, the legend widget is really impressive and I did find it before I posted the question. I was looking for a more lightweight and out-of-the-box solutions and I just overlooked the autoUpdate parameter of the esri legend dijit. That should do the trick for me, although setting it to true means the legend is not sensitive to map scale any more so one would somehow need to refresh the legend in map.on("extent-change", ...) using map.getLayersVisibleAtScale().

Filip.

0 Kudos