Nianwei Liu. Good morning:
Does your TOC support WMS Layer? How could I make the legend of its layers in a WMS Layer?
Thank you very much and forgive for the inconvenience.
When you add the WMS layer you point to the URL for the legend image:
// Typical usage
var layer = new WMSLayer({
url: // url to the service,
sublayers: [{
name: // name of the sublayer,
legendUrl: // url to the legend
}]
});
https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-WMSLayer.html
Thank you very much for your answer.
And forgive for the inconvenience, but when I asked the question do not specify that it is for version 3.x
Here is an example of using a WMS layer with a Legend and a LayerList widget.
Specifically, I use the dijit / TOC of this example:
http://www.arcgis.com/home/item.html?id=9b6280a6bfb0430f8d1ebc969276b109