Adobe Flex removes some of the crowded labels in chart

Adobe Flex removes some of the crowded labels in chart

Postby haretu » Sat Mar 26, 2011 10:39 am

Adobe Flex removes some of the crowded labels along the horizontal axis by setting the canDropLabels style.
Code: Select all
<?xml version="1.0"?>
<!-- http://blog.flexexamples.com/2007/10/16/dropping-labels-in-a-flex-chart/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">

    <mx:XML id="quotesXML" source="adbe.xml" format="e4x" />
    <mx:XMLListCollection id="adbe" source="{quotesXML.quote}" />

    <mx:String id="ADBE_YAHOO">http://finance.yahoo.com/q?d=t&s=ADBE</mx:String>

    <mx:ApplicationControlBar dock="true">
        <mx:CheckBox id="checkBox"
                label="canDropLabels:"
                labelPlacement="left" />
    </mx:ApplicationControlBar>

    <mx:LinkButton
            label="ADBE"
            click="navigateToURL(new URLRequest(ADBE_YAHOO))"
            fontSize="14"
            fontWeight="bold" />

    <mx:HLOCChart id="hlocChart"
            showDataTips="true"
            dataProvider="{adbe}"
            width="100%"
            height="100%">

        <!-- vertical axis -->
        <mx:verticalAxis>
            <mx:LinearAxis baseAtZero="false" title="Price" />
        </mx:verticalAxis>

        <!-- horizontal axis -->
        <mx:horizontalAxis>
            <mx:CategoryAxis categoryField="@date" title="Date" />
        </mx:horizontalAxis>

        <!-- horizontal axis renderer -->
        <mx:horizontalAxisRenderer>
            <mx:AxisRenderer canDropLabels="{checkBox.selected}" />
        </mx:horizontalAxisRenderer>

        <!-- series -->
        <mx:series>
            <mx:HLOCSeries id="series1"
                    highField="@high"
                    lowField="@low"
                    openField="@open"
                    closeField="@close"/>
        </mx:series>
    </mx:HLOCChart>

</mx:Application>
Attachments
Screen shot 2011-03-26 at 10.37.53 AM.png
Screen shot 2011-03-26 at 10.37.53 AM.png (35.12 KiB) Viewed 679 times
haretu
 
Posts: 132
Joined: Sat Jan 08, 2011 9:56 pm

Return to Adobe FLEX Flash

Who is online

Users browsing this forum: No registered users and 1 guest

cron