Legend Title in 4.0

1765
2
Jump to solution
07-11-2016 02:11 PM
LoriEmerson_McCormack
Occasional Contributor

When I create my legend, the name from my published map service is listed at the top of the legend pane.  How do I turn if off?  I tried setting the title in the Legend widget, and I also tried hiding and replacing the label in my css (see below).  Note:  I added my feature layer using the URL.

css:

.esri-legend {

     background-color: #f3f3f3;

}

.esri-legend__service-label span {

     visibility: hidden;

}

.esri-legend__service-label span::after {

     content: "Legend";

}

javascript:

view.then(function() {

    var legend = new Legend({

          view: view,

          layerInfos: [{

               layer: lyrADT,

               title: "Average Daily Traffic"

          }]

     }, "legendDiv");

     legend.startup();

0 Kudos
1 Solution

Accepted Solutions
UndralBatsukh
Esri Regular Contributor

Hi there,

Hopefully, this is what you are asking for.

This will hide layer title in the legend.

.esri-legend__layer-caption {

      display: none;

}

This will hide legend title in the legend.

.esri-legend__service-label {

      display: none;

}

View solution in original post

2 Replies
UndralBatsukh
Esri Regular Contributor

Hi there,

Hopefully, this is what you are asking for.

This will hide layer title in the legend.

.esri-legend__layer-caption {

      display: none;

}

This will hide legend title in the legend.

.esri-legend__service-label {

      display: none;

}

LoriEmerson_McCormack
Occasional Contributor

Undral,

Yes, that did it!  Thanks so much for your help.

I recommend watching the ESRI training video online called Time-Saving Tips for JavaScript Developers, for anyone else who has similar CSS issues with widgets.

0 Kudos