The Legend Widget sample and API page demonstrate how to add one layer to the widget, but I want to add multiple layers. I know that if I don't include the layerInfos property, all the layers will show, but what syntax do I need to use in order to add just the layers I want and to have more control over what it says next to each layer? I tried this:
var legend = new Legend({
view: view,
layerInfos: [{
layer: [parkingLayer, votingLayer],
title: "Random Layers"
}]
});
legend.startup();
view.ui.add(legend, "bottom-right");
What I get is a little box at the bottom right that says "No Legend".
Another odd thing is that when I add only one layer it works except my title doesn't show up. If I only add the parking layer it says "Main Map-Parking Lots" next to it, but no title.
Any pointers on this are much appreciated.
Solved! Go to Solution.
Thanks for the help from everyone, I really appreciate it!