Select to view content in your preferred language

How to remove layer from legend

2617
4
09-02-2016 09:00 AM
by Anonymous User
Not applicable

I think I am doing something wrong. When I use the Legend for the example in API javascript I get an extra layer that is not on my map named other. How do I remove this from my Legend.

0 Kudos
4 Replies
RickeyFight
MVP Regular Contributor

What does the legend look like in the mxd for the service? 

0 Kudos
by Anonymous User
Not applicable

I render the layer in the web page. All the layer in that mxd are lines and points and one poly that is off.

0 Kudos
RickeyFight
MVP Regular Contributor

If you look here: Legend | API Reference | ArcGIS API for JavaScript 3.17 

It says in a few places that you can choose what layers display

<Object[]> layerInfosOptionalSpecify a subset of the layers in the map to display in the legend. If not set, all layers in the map will display in the legend. The order of the layers in the legend depends on the layerInfo array. See the layerInfos property description for a description of its object properties.
yanli
by
Emerging Contributor

set the legend property  "defaultsymbol:false"