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.
What does the legend look like in the mxd for the service?
I render the layer in the web page. All the layer in that mxd are lines and points and one poly that is off.
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[] > layerInfos | Optional | Specify 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. |
set the legend property "defaultsymbol:false"