Select to view content in your preferred language

Can we edit legend

4806
14
05-23-2011 08:50 PM
MohammedIsmail
Emerging Contributor
i want to change legend Title how can i change
Tags (2)
0 Kudos
14 Replies
RobertScheitlin__GISP
MVP Emeritus
Mohammed,

   Manipulate the symbology of the layer in the MXD/MSD that the Map Service comes from.
0 Kudos
MohammedIsmail
Emerging Contributor
Thanks Robert

am having another problem like am using LayerTOC and i have listed all the layers in that when i click the checkbox, legend is not getting updated automatically when i zoom in or zoom out it is getting updated.

But i want it like when i click in LayerTOC i should get changed

Thanks & regards
Waiting for ur reply
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Mohammed,

   I can not actually say exactly what you need to do as I dont personally use the API's Legend component, but I would guess that you need to set the Legends map to null and back again to the map component after a layer is hidden or shown from the layerTOC. In the layerTOC look at the hideLayer and showLayer functions.
0 Kudos
MohammedIsmail
Emerging Contributor
you can check the attach screen shot (JPEG format)

i have changed the layer but the legend has not been changed

Thanks & regards

Ismail
0 Kudos
MohammedIsmail
Emerging Contributor
Legend is not getting updated when i change the layer

Please help me how to solve this

Thanks & regards
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Mohammed,

  It would be best if you post your whole code.
0 Kudos
MohammedIsmail
Emerging Contributor
Hi

Below is the code
i want the legend tobe updated automatically when i made any change in TOC

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx"
    xmlns:esri="http://www.esri.com/2008/ags"
    xmlns:samples="com.esri.ags.samples.*"
    initialize="application1_initializeHandler(event)"
    >

<fx:Script>
  <![CDATA[
  
   import mx.events.FlexEvent;
   protected function application1_initializeHandler(event:FlexEvent):void
   {
    myLegend.layers = [ myDynamicService ];
   }
   protected function myLegend_updateCompleteHandler(event:FlexEvent):void
   {
    // TODO Auto-generated method stub
   }
  ]]>
</fx:Script> 
<s:HGroup width="180%" height="180%">
  <mx:HDividedBox width="50%" height="100%" dropShadowVisible="false" horizontalGap="8">
   <samples:LayerTOC width="50%" height="100%"  id="lt" 
         mapLayer="{myDynamicService}"/>

 
  <esri:Map id="MyML">
   <esri:ArcGISDynamicMapServiceLayer id="myDynamicService"
              load="myDynamicService.defaultVisibleLayers()"
              url="http://gisserver/ArcGis/rest/services/raichur/MapServer/">
   </esri:ArcGISDynamicMapServiceLayer>
  </esri:Map>
 
 
  <s:VGroup width="50%" height="80%">
   <esri:Legend id="myLegend"
       width="100%" height="100%"
       map="{MyML}"
       respectCurrentMapScale="true"/>
  </s:VGroup>  
 

  
  </mx:HDividedBox>
 
</s:HGroup>

</s:Application>
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Mohammed,

   Just update this function:

protected function application1_initializeHandler(event:FlexEvent):void
            {
                myLegend.layers = [ myDynamicService.visibleLayers ];
            }
0 Kudos
MohammedIsmail
Emerging Contributor
hi scheitlin


Its not working 

it is diplaying all visible layers in the legend but

when i made any change in the TOC , legend is not getting updated

any other option to link TOC with legend

waiting for ur reply
Thanks
0 Kudos