I need to suppress the Legend Title and the Layer Names.
Can't yet figure out how to show a legend without them.
Any help is appreciated.
Thanks,
Keith
I need to suppress the Legend Title and the Layer Names.
Can't yet figure out how to show a legend without them.
Any help is appreciated.
Thanks,
Keith
try adding a title:" " in your legendInfos like this:
Code:var legend = new esri.dijit.Legend({ map:map, layerInfos:[ {layer:yourfirstlayer, title:" "}, {layer:yoursecondlayer, title:" "} ] }, "legendDiv"); legend.startup();
Hope this helps.
Code:legendLayers.push({layer:layer,title:'YOUR TITLE'});

You can use css to prevent the layer names from displaying. The API reference for the Legend Widget lists the available css classes.
http://help.arcgis.com/en/webapi/jav...api/legend.htm
Here's an example of css that I'd add if I wanted to hide the display of the service title:
Code:.esriLegendServiceLabel { display: none; }
Great, thanks everyone for your help.
I have the same issue. But, I am sorry, I am new at adding custom code for arcmap. Do you use these codes in python? I tried running some of the codes you all gave, and I had errors. I typed them out by hand in the python window. Any thoughts?
Thanks,
STeve
Hey Steve.
These questions and answers apply specifically to the Javascript API.
.esriLegendServiceLabel {
display: none;
}
would go in the styles section and suppresses the output of the legend labels.
The other code would go in the script where you are creating your legend.
Sorry about that, by the other code I meant the code snippets submitted by Davide and Craig in response to my question, included below.
var legend = new esri.dijit.Legend({
map:map,
layerInfos:[
{layer:yourfirstlayer, title:" "},
{layer:yoursecondlayer, title:" "}
]
}, "legendDiv");
legend.startup();
legendLayers.push({layer:layer,title:'YOUR TITLE'});
These are two different ways to change the titles in the legend and would be included in the SCRIPT section of the code where you set up the legend.
Bookmarks