djain-esristaff

Legend not visible, gets a message "No Legend"

Discussion created by djain-esristaff on Mar 4, 2012
Latest reply on Mar 6, 2012 by ciava.at
Hi

I am using javascript sample of Legend, but when I am removing the arcgis dynamic layer link and adding the link to my service, it displays the content pane as "No Legend".

It works fine with the online dynamic layers.

var quakeLayer = new esri.layers.ArcGISDynamicMapServiceLayer("Link to me service", { id: 'quakes' });

            legendLayers.push({ layer: quakeLayer, title: 'Earthquakes' });

            dojo.connect(map, 'onLayersAddResult', function (results) {
                var legend = new esri.dijit.Legend({
                    map: map,
                    layerInfos: legendLayers
                }, "legendDiv");
                legend.startup();
            });
            map.addLayers([quakeLayer]);

in the init function

But i do not get the legend.

Any help is greatly appreciated.

Thanks
Deepika

Outcomes