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

08-13-2018 01:01 AM
New Contributor II

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

0 Kudos
2 Replies
MVP Esteemed Contributor


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

New Contributor II

Thank You Robert.

0 Kudos