AnsweredAssumed Answered

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

Question asked by adarsh2402 on Aug 13, 2018
Latest reply on Aug 13, 2018 by rscheitlin

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