I have recently created a web map that uses the legend snippet from the ESRI JavaScript API website. https://developers.arcgis.com/en/jav...et_legend.html
It works great for the most part, but has one issue, there are duplicate entries in the legend. The rest services that I am using are all symbolized properly without duplicates. The method I'm using to add the services to the map is through a feature layer.
This is the exact code in my .js file.
dojo.connect(myMap, 'onLayersAddResult', function (results) { var layerInfo = dojo.map(results, function (layer, index) { return { layer: layer.layer, title: layer.layer.name }; }); if (layerInfo.length > 0) { var legendDijit = new esri.dijit.Legend({ map: myMap, layerInfos: layerInfo}, "legendDiv"); legendDijit.startup(); } }); //Layers are added to map myMap.addLayers([featureLayer1, DMSL_StudyArea]); Any information would help.
Thanks
أكثر...
It works great for the most part, but has one issue, there are duplicate entries in the legend. The rest services that I am using are all symbolized properly without duplicates. The method I'm using to add the services to the map is through a feature layer.
This is the exact code in my .js file.
dojo.connect(myMap, 'onLayersAddResult', function (results) { var layerInfo = dojo.map(results, function (layer, index) { return { layer: layer.layer, title: layer.layer.name }; }); if (layerInfo.length > 0) { var legendDijit = new esri.dijit.Legend({ map: myMap, layerInfos: layerInfo}, "legendDiv"); legendDijit.startup(); } }); //Layers are added to map myMap.addLayers([featureLayer1, DMSL_StudyArea]); Any information would help.
Thanks
أكثر...