Select to view content in your preferred language

Table of Contents - Legend Widget for FlexViewer 2.x

122404
664
12-01-2010 07:30 AM
RobertScheitlin__GISP
MVP Emeritus
All,

Here is the next in my line of widgets for the FlexViewer 2.x.

The legend portion of this widget is the same code as my dynamic legend widget so,

IT IS FOR ARCGIS SERVER 10 OR GREATER ONLY

This is just a simple TOC Widget that includes my dynamic legend component.
This widget also includes my enhancement for map service transparency,
right click context menu for zoom to make layer visible, and my scale
dependent renderer for the TOC checkboxes.
Tags (2)
0 Kudos
664 Replies
SpatialNinja
Esri Regular Contributor
Patrick,

   There is NO option to have the legends expanded and not thier parent nodes. You need to check if you are pointing to the correct xml file in the main config.xml and that you have cleared your browsers cache.


Yeah, I've cleared my cache and am having the same issues.  What does the <collapselegends></collapselegends> tag do?  Before when I had it set to FALSE, the legends were automatically expanded under the layer, but now, switching back and forth from TRUE to FALSE has no differentiating effect on the widget.

Thanks again for your help.
Solutions Engineer | Spatial Ninja  | GIS ️ | Telecommunications
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Patrick,

   Something is definitely off then. The collapselegends tag specifies whether the legend swatch is visible by default when the parent node is expanded. So here is an example of how to expand all nodes without their legends being visible:

        <expanded everything="false">true</expanded>
        <collapselegends>true</collapselegends>


If you set the everything attribute to true this overrides the collapselegends tag.

I found an bug in the widget and the visibilitylabel is not used. In version 3.5 add a title tag instead.

    <labels>
        <title>Legend</title>
        <expandall>Expand All Layers</expandall>
        <collapseall>Collapse All Layers</collapseall>
        <zoomtomakevisible>Zoom To Make Visible</zoomtomakevisible>
    </labels>
0 Kudos
SpatialNinja
Esri Regular Contributor
Patrick,

   Something is definitely off then. The collapselegends tag specifies whether the legend swatch is visible by default when the parent node is expanded. So here is an example of how to expand all nodes without their legends being visible:

        <expanded everything="false">true</expanded>
        <collapselegends>true</collapselegends>


If you set the everything attribute to true this overrides the collapselegends tag.

I found an bug in the widget and the visibilitylabel is not used. In version 3.5 add a title tag instead.

    <labels>
        <title>Legend</title>
        <expandall>Expand All Layers</expandall>
        <collapseall>Collapse All Layers</collapseall>
        <zoomtomakevisible>Zoom To Make Visible</zoomtomakevisible>
    </labels>


Thanks, I added the <title> and it works fine now.  And I do want the legend swatch to be visible by default.  So I have it as:
<expanded everything="false">false</expanded>
<collapselegends>false</collapselegends>
But when I expand the layer items, I must expand again to see the symbols and its not showing by default.
Solutions Engineer | Spatial Ninja  | GIS ️ | Telecommunications
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Patrick,

   Yep, it will not work the way you want it to. The legends with only be open by default if the parent node is open by default.
0 Kudos
SpatialNinja
Esri Regular Contributor
Okay, thanks Robert.  I think just remember it working that way when it was the TOC widget.  Thanks for the clarification.
Solutions Engineer | Spatial Ninja  | GIS ️ | Telecommunications
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Patrick,

   Hmm... Something I will have to look into then.
0 Kudos
KeisukeNozaki
Frequent Contributor
I am trying to exclude one layer in the legend.

<excludelayers>
    <excludelayer mapservice="mcdonough_highway">white_background</excludelayer>
</excludelayers>

I confirmed map service and layer name are correct.
But the layer still shows up.
Please let me know if I am missing something.
I use TOC widget 3.3.
Thank you.

Keisuke
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Keisuke,

   I see that I do not cover this in the documentation. What you have to do is use the mapservice name but the layer ID not a string.


<excludelayers>
    <excludelayer mapservice="mcdonough_highway">2,3,5</excludelayer>
    </excludelayers>


or

<excludelayers>
    <excludelayer mapservice="mcdonough_highway">1</excludelayer>
    </excludelayers>
0 Kudos
BretWhiteley1
Deactivated User
Robert,  I am trying to create a legend in the FLEX viewer (using builder) that allows for layer groupings.  I contacted ESRI Tech Support and they indicated that the best way to achieve this is through the use of your tool.  I downloaded and successfully added the widget "For_AppBuilder3.5" to my FLEX builder.  Now I am trying to figure out how to actually group the layers I want grouped.  When I published the data from ArcMAP (10.1 sp1), it was grouped and as such the layer id from the REST service skips numbers where the layer group is.  I have tried to find documentation regarding your widget on how to achieve the grouping - but cannot seem to find it.  Can you provide a link to instructions?

I should qualify that I am using feature services, not map services!!

Thanks kindly for a great service.

Bret.
0 Kudos
KeisukeNozaki
Frequent Contributor
Robert,

I thought it worked, but the layer still shows up.
The layer I want to hide is http://gis.wiu.edu/arcgis/rest/services/mcdonough_highway/MapServer/28 and here is my code.

<configuration>
<labels>
  <visibilitylabel>Layer Visibility</visibilitylabel>
  <expandall>Expand All Layers</expandall>
  <collapseall>Collapse All Layers</collapseall>
  <zoomtomakevisible>Zoom To Make Visible</zoomtomakevisible>
  <generatinglegendmsg>Generating TOC Legend</generatinglegendmsg>
</labels>
<tocsettings>
  <expanded everything="false">true</expanded>
  <collapselegends>true</collapselegends>
  <disablezoomtomenuoption>false</disablezoomtomenuoption>
</tocsettings>
<excludelayers>
    <excludelayer mapservice="mcdonough_highway">28</excludelayer>
</excludelayers>
<excludegraphiclayers>true</excludegraphiclayers>
<excludebasemaplayers>true</excludebasemaplayers>
<usenewesridescription>false</usenewesridescription>
</configuration>

Thank you for your time.

Keisuke
0 Kudos