+ Reply to Thread
Results 1 to 9 of 9

Thread: Legend Title / Layer Names

  1. #1
    Keith Ganzenmuller
    Join Date
    Apr 2010
    Posts
    82
    Points
    3
    Answers Provided
    4


    0

    Default Legend Title / Layer Names

    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

  2. #2
    Davide Limosani
    Join Date
    Jun 2011
    Posts
    62
    Points
    39
    Answers Provided
    6


    1

    Default Re: Legend Title / Layer Names

    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();

  3. #3
    Craig McDade
    Join Date
    Jul 2010
    Posts
    190
    Points
    19
    Answers Provided
    7


    0

    Default Re: Legend Title / Layer Names

    Hope this helps.

    Code:
    legendLayers.push({layer:layer,title:'YOUR TITLE'});

  4. #4
    Kelly Hutchins

    Join Date
    Oct 2009
    Posts
    885
    Points
    622
    Answers Provided
    106


    0
    This post is marked as the answer

    Default Re: Legend Title / Layer Names

    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;
    }

  5. #5
    Keith Ganzenmuller
    Join Date
    Apr 2010
    Posts
    82
    Points
    3
    Answers Provided
    4


    0

    Default Re: Legend Title / Layer Names

    Great, thanks everyone for your help.

  6. #6
    steve archambault
    Join Date
    May 2010
    Posts
    5
    Points
    0
    Answers Provided
    0


    0

    Default Re: Legend Title / Layer Names

    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

  7. #7
    Keith Ganzenmuller
    Join Date
    Apr 2010
    Posts
    82
    Points
    3
    Answers Provided
    4


    0

    Default Re: Legend Title / Layer Names

    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.

  8. #8
    steve archambault
    Join Date
    May 2010
    Posts
    5
    Points
    0
    Answers Provided
    0


    0

    Default Re: Legend Title / Layer Names

    Quote Originally Posted by kganz View Post
    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.
    Okay, I am slowly getting it. What do you mean the other code?

  9. #9
    Keith Ganzenmuller
    Join Date
    Apr 2010
    Posts
    82
    Points
    3
    Answers Provided
    4


    0

    Default Re: Legend Title / Layer Names

    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.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts