Select to view content in your preferred language

Create a dynamic legend?

2013
4
11-06-2013 08:03 AM
YangLiu2
Deactivated User
Hi,

I am kind of new on Javascript. I am trying to create a dynamic legend, which can show new adds also can show only symbology of   the current extent view. For example, if people zoom in to one feature, on the legend, there is only the one feature. When people zoom out to full extent, all features are shown on the legend. Another example is that if I add a new feature into map, the legend automatically include the new feature symbology. How can I generate the dynamic legend using Javascript? Any thought? Thanks!

-YL
0 Kudos
4 Replies
ErwinSoekianto
Esri Alum
I think you want to play around with the paremeter "layerinfo" from this documentation https://developers.arcgis.com/en/javascript/jsapi/legend.html


This is the closest sample https://developers.arcgis.com/en/javascript/jssamples/widget_legendvisible.html
0 Kudos
GeorgeHaskett
Deactivated User
YL,

Is this for the same project we spoke about earlier?  If so and you are now looking into the Viewer for Flex, then check out the Dynamic Legend widget from Rob:

http://www.arcgis.com/home/item.html?id=f60406b9f52340d59eb557bf64136af6

I think this should be able to do what you are looking for, assuming that you have changed your platform over to the Viewer for Flex.

Haskett
0 Kudos
YangLiu2
Deactivated User
YL,

Is this for the same project we spoke about earlier?  If so and you are now looking into the Viewer for Flex, then check out the Dynamic Legend widget from Rob:

http://www.arcgis.com/home/item.html?id=f60406b9f52340d59eb557bf64136af6

I think this should be able to do what you are looking for, assuming that you have changed your platform over to the Viewer for Flex.

Haskett


Hi Haskett,

Yes, it is. Thanks for the Dynamic Legend widget you shared. I also want my legend to show only visible extent symbols on it when zooming in or zooming out the map. For example, I have a fire station points layer. When I zoom out a full extent, all fire stations in a county are listed on the legend; and then I zoom in to a specific fire station, there's only the one fire stations shown on the legend. Do you think this is possible? Do you have any idea if using ArcGIS Viewer for Flex? Thanks!

-YL

-YL
0 Kudos
GeorgeHaskett
Deactivated User
I normally have my symbology set up so that it only shows one icon for all similar features.  For example, I would have one symbol for all firestations, etc.  However I do break up unique items like policies or criminal events, etc.

One of the primary functions of the Dynamic Legend is to allow the layers to be removed from the legend as they disappear within the map view, usually due to min/max scales.

A quick test indicates that in its default mode, while the individual layers come and go, the various icons in a unique layer are always present when the layer itself is present.  So in other words, depending upon how you set up your original map it may or may not work as you hoped...

The best person to ask regarding the Dynamic Legend is Rob Scheitlin, the author.  It may or may not have additional settings that would let you do what you want to do.  If you create a new thread discussing the Dynamic Legend directly with his name in the title, then he will usually get in touch.

If this helps or answers your question, please indicate by clicking on the selector on the right side of the response in question.
0 Kudos