Select to view content in your preferred language

How to show Dynamic legend for categories using unique values of one field. ???

903
4
08-13-2018 01:01 AM
AdarshSharma
Emerging Contributor

I am using arc gis api for java script 3.16. We are facing issues for showing dynamically category wise legend. i have Draw categories using unique values of one field in symbology of layer property arc map 10.3.1 and than publish this .mxd file as a map service and this service use in my program and i want to show only those legend category symbol which are exist on map but my map show legend according to layer wise if layer is on legend show properly but i am showing only those symbol which value are exist on map not all.

i am using this code for showing legend.

var legend = new Legend({
map : map,
layerInfos : [ {
layer : layer,
title : "Legend"
} ]
}, "legend");
legend.startup();  

0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Emeritus

Adarash,

   There is no ability currently to have the legend only show the categories that exist in the current view.

AdarshSharma
Emerging Contributor

Thank You Robert.

0 Kudos
RobertKirkwood
Frequent Contributor

Rob,

How is it that the Print fucntion will show the legend that refelcts the data that is zoomed in? But, the actual legend does not update the same way? 

0 Kudos
RobertKirkwood
Frequent Contributor

Any updates for this? 

0 Kudos