Dynamic Legend widget for Flexviewer 2.0

3843
65
07-29-2010 01:18 PM
RobertScheitlin__GISP
MVP Emeritus
All,

    I am happy to announce the first community developed (and shared on the code gallery) widget for the Flexviewer 2.0. I have finalized my Dynamic Legend Widget for the 2.0 FlexViewer and shared it for all to use.

This version is COMPLETELY dependent on 2 things

  1. ArcGIS Server 10 map services

  2. Flex Viewer 2.0 and obviously Flex API 2.0


I have made it XML configurable this time so that you can specify that certain map services or certain layers in a map service are not to be displayed in the widget.

It is called dynamic because the legend will only draw map services and layer that are visible in your map. It respects scale dependency of layers and if the layer is checked in the TOC or operational layer TOC. The legend automatically redraws when layers have been checked/unchecked and when zooming in or out and a layer scale dependency has been meet.

I hope you enjoy it and I HOPE that you read and understand that it will not work with mapservices that are not served from a ArcGIS 10 Server.

http://www.arcgis.com/home/item.html?id=f60406b9f52340d59eb557bf64136af6

PS. don't forget to rate the code.
Tags (2)
0 Kudos
65 Replies
SimonMorgan
Occasional Contributor III
I apologize if I am missing something, but should the download incldue a swf or do I need to compile it myself?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Simon,

     You do need to compile it your self. I have always had bad experiences distributing compiled swfs in the past.
0 Kudos
SimonMorgan
Occasional Contributor III
Thanks for the reply, just making sure. Just having some issues with compiling right now, says unable to open 'locale/en_US'.
0 Kudos
SimonMorgan
Occasional Contributor III
Thanks for the reply, just making sure. Just having some issues with compiling right now, says unable to open 'locale/en_US'.


Although, I should point out this happens when I try to compile with your widget too, so I will just keep researching. Thank you for all the time and effort you put into helpign the flex community!!
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Simon,

   Make sure you have locale/{locale} added as a source path in your flexviewer project properties under the "Flex Build Path".

Also ensure you have these "additional compiler arguments" added to the "Flex Compiler" page: -locale en_US -source-path=locale/{locale}
0 Kudos
SimonMorgan
Occasional Contributor III
I have all that in there, I have tried both with {locale} and with specifying "en_US". I still get the issue. I apologize for hijackign your thread here.
0 Kudos
TomJones
New Contributor
Hi Robert

I've already successfully implemented the first dynamic legend that you published a while back. However I am now interested in only showing the visible layers that have been selected in the legend.

I tried implementing your code - I am using Adobe Flash Builder 4 - but I receive the following error :
" Unable to locate specified base class 'com.esri.viewer.BaseWidget' for component class 'com.esri.solutions.flexviewer.widgets.DynamicLegend.DynamicLegendWidget'."

When i change the "viewer" namespace to "flexviewer", it returns the following error:
" The prefix "flexviewer" for element "flexviewer:BaseWidget" is not bound."

Your help would be kindly appreciated.
Thanks for all the other magnificent samples 🙂

Kirti


All,

    I am happy to announce the first community developed (and shared on the code gallery) widget for the Flexviewer 2.0. I have finalized my Dynamic Legend Widget for the 2.0 FlexViewer and shared it for all to use.

This version is COMPLETELY dependent on 2 things

  1. ArcGIS Server 10 map services

  2. Flex Viewer 2.0 and obviously Flex API 2.0


I have made it XML configurable this time so that you can specify that certain map services or certain layers in a map service are not to be displayed in the widget.

It is called dynamic because the legend will only draw map services and layer that are visible in your map. It respects scale dependency of layers and if the layer is checked in the TOC or operational layer TOC. The legend automatically redraws when layers have been checked/unchecked and when zooming in or out and a layer scale dependency has been meet.

I hope you enjoy it and I HOPE that you read and understand that it will not work with mapservices that are not served from a ArcGIS 10 Server.

http://www.arcgis.com/home/item.html?id=f60406b9f52340d59eb557bf64136af6

PS. don't forget to rate the code.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Kirti,

   You didn't miss this part did you?

This version is COMPLETELY dependent on 2 things

   1. ArcGIS Server 10 map services
   2. Flex Viewer 2.0 and obviously Flex API 2.0

It sound like you are trying to use the Sample Flex Viewer 1.x.
0 Kudos
TomJones
New Contributor
I unfortunately did 😮 My apologies, think I was a bit to eager to implement this functionality.

Could you perhaps guide me in the direction for this same functionality for Sample Flex Viewer. I have read previous threads in the old forums but they were a bit complicated and I am a beginner at flex.

Thanks.

Kirti,

   You didn't miss this part did you?

This version is COMPLETELY dependent on 2 things

   1. ArcGIS Server 10 map services
   2. Flex Viewer 2.0 and obviously Flex API 2.0

It sound like you are trying to use the Sample Flex Viewer 1.x.
0 Kudos