Select to view content in your preferred language

How to customize Legend in Web Appbuilder

5635
7
01-06-2016 06:39 AM
ShaziaNoreen
Emerging Contributor

Hi

Is is possible to add a service in legend without adding it as layer in Web Appbuilder (local layer) or ArcGIS Portal map?

Thanks

Shazia

0 Kudos
7 Replies
RebeccaStrauch__GISP
MVP Emeritus

Shazia, it may help to explain the use case for this. Are you just wanting a graphic of a layer in your legend without it ever drawing or without any access to the data?  I'm not sure that I understand the need for this.

With that said, I probably wouldn't bee the one that could answer this, but it may help others to know more information.

0 Kudos
StefanP__Jung
Deactivated User

A case i can imagin:

If you add a Stream Layer to a WebMap it only supports a simple renderer. If you want e.g. a unique value renderer you have to implement it by yourself. In this case you also need to modify the Legend and Layerlist.

0 Kudos
ShaziaNoreen
Emerging Contributor

Rebecca

Thanks for the reply.

We have a tiled service called FSM used as a basemap in Portal web map.

That webmap is used in Web appbuilder. We want to show its legend in the application when that basemap is selected.When we switch to imagery basemap, FSM basemap legend shall not be displayed.

Any help.

Thanks.

Shazia

0 Kudos
GirishYadav
Deactivated User

Shazia,

The Legend dijit respect the layer visibility on the map. Therefore, if you just hide the FSM layer it should not be visible on the legend. The layer will NOT be removed from the map it will just be hidden.

Layer.visible = false;

OR

Layer.hide();

-Girish

RebeccaStrauch__GISP
MVP Emeritus

Are you using the AGOL version or are you using the develop edition of WAB?

if the dev edition, I would take a look at the custom widget Enhanced Basemap Gallery Widget 1.3 - 12/14/2015   and some of the other custom widgets available Web AppBuilder Developer Edition - Customization Resource List

But as Girish mentioned, the legend should respect the layers you have visible.

0 Kudos
JordanBaumgardner
Frequent Contributor

Could you have your JS code simply insert another row into the Legends Div with the Icon and Label you want?

AveKargaja
Deactivated User

Well, if the aim is to show just the legend (as a picture or table or any kind of html element) in the legend widget, then sure, one can just add it as another div section to the widgets\Legend\Widget.html file.

0 Kudos