The following image shows the layer list implementation of my ArcGIS map. There is a layer list option called 'Legend' which shows the legend of that respective layer within the item panel.
However, the respective layer must be visible on the map to show the legend. But I need to show each layer's legend when clicking on the legend option regardless of its visibility on the map.
(current code is attached below)
1) Is there a way to do the above implementation?
Further once item panel make visible it shows a question mark symbol on the layer list item (Image below).
2) Is there a way to remove this?
Solved! Go to Solution.
Hi @LakshanRasingolla ,
You can use the respectLayerVisibility property on the Legend, and you can add a "legend" icon or any of the other calcite icons the question mark would be replaced. The panel in an interactive element and the button is there to allow the user to expand and collapse the panel.
https://codepen.io/sagewall/pen/wvVJdOR
new Legend({
view: view,
container: legendContainer,
layerInfos: [{ layer: item.layer }],
respectLayerVisibility: false,
});
item.panel = {
content: legendContainer,
icon: "legend",
open: true,
};
Hi @LakshanRasingolla ,
You can use the respectLayerVisibility property on the Legend, and you can add a "legend" icon or any of the other calcite icons the question mark would be replaced. The panel in an interactive element and the button is there to allow the user to expand and collapse the panel.
https://codepen.io/sagewall/pen/wvVJdOR
new Legend({
view: view,
container: legendContainer,
layerInfos: [{ layer: item.layer }],
respectLayerVisibility: false,
});
item.panel = {
content: legendContainer,
icon: "legend",
open: true,
};
@Sage_Wall This worked. Thanks !