Select to view content in your preferred language

Legend Content Alignment

869
4
12-14-2010 12:14 PM
JimWelsh
Deactivated User
Using Flex 2.2 Dynamic Legend

The legend in 2.2 is working beautifully, but I have one question.  The legend is displaying the label followed by the icon, which is on the next line.  In the sample pictures, the label and icon appear to be on the same line. 

Any idea why mine is displaying on seperate lines?  I assume it may have to do with the length of the labels, but I wasn't sure where to adjust for that.

Thank you.
Tags (2)
0 Kudos
4 Replies
DasaPaddock
Esri Regular Contributor
I'm not able to reproduce this. When I make the Legend component too small, I get horizontal scroll bars. Can you try updating this with your service?

<?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:esri="http://www.esri.com/2008/ags">

    <s:layout>
        <s:HorizontalLayout gap="0"/>
    </s:layout>

    <esri:Legend id="myLegend"
                 width="150" height="100%"
                 layers="{[ legendLayer ]}"
                 map="{myMap}"
                 respectCurrentMapScale="true"/>

    <esri:Map id="myMap">
        <esri:extent>
            <esri:Extent xmin="-10753431" ymin="4624151" xmax="-10737799" ymax="4635884">
                <esri:SpatialReference wkid="102100"/>
            </esri:Extent>
        </esri:extent>
        <esri:ArcGISTiledMapServiceLayer id="baseLayer" url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>
        <esri:ArcGISDynamicMapServiceLayer id="legendLayer" name="Kansas Hydrography"
                                           url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Hydrography/Watershed173811/MapServer"/>
    </esri:Map>

</s:Application>
0 Kudos
JimWelsh
Deactivated User
Dasa,

I think I have figured out what is occurring.  I have various crime types seperated into different layers, as I want the user to be able to turn on/off individual crime types.  I didn't see an easy way to do this with sub-layers.

With that said, what I am seeing is actually the layer title with the icon on the next line.  If I add multiple category icons (such as Drug Violations in the attachment), it displays the icon next to the category as I desire.

Is there a better way to accomplish this?

Thank you.
0 Kudos
JimWelsh
Deactivated User
For the record, in ArcMap\LayerProperties\Symbology Tab, I added a legend label as a test.  This labeled the symbol, but then I end up with the same thing repeated on two lines.
0 Kudos
DasaPaddock
Esri Regular Contributor
You can turn on and off the sub-layers of a dynamic service by setting the visibleLayers property:
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/ArcGISDynamicMapServiceLayer.html#v...
0 Kudos