The following example shows how you can change the start angle in a Flex Pie Chart.

Full code after the jump.

For more information on setting up charting in an Adobe Flex 3 Beta 1 project, see “Charting in Flex Builder 3 (public beta 1 edition)”.

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/09/24/setting-a-flex-pie-charts-start-angle/ -->
<mx:Application name="PieChart_startAngle_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">
 
    <mx:Script>
        <![CDATA[
            private function degrees_func(item:Number):String {
                return item + String.fromCharCode(176);
            }
        ]]>
    </mx:Script>
 
    <mx:Array id="dp">
        <mx:Object data="3" />
        <mx:Object data="1" />
        <mx:Object data="4" />
        <mx:Object data="1" />
        <mx:Object data="5" />
        <mx:Object data="9" />
    </mx:Array>
 
    <mx:ApplicationControlBar dock="true">
        <mx:Label text="startAngle:" />
        <mx:HSlider id="slider"
                minimum="0"
                maximum="360"
                liveDragging="true"
                snapInterval="1"
                tickInterval="10"
                showTrackHighlight="true"
                dataTipPrecision="0"
                dataTipFormatFunction="degrees_func" />
    </mx:ApplicationControlBar>
 
    <mx:PieChart id="chart"
            height="100%"
            width="100%"
            dataProvider="{dp}">
        <mx:series>
            <mx:PieSeries id="pieSeries"
                    field="data"
                    startAngle="{slider.value}" />
        </mx:series>
    </mx:PieChart>
 
</mx:Application>

View source is enabled in the following example.

 
Tagged with:
 
About The Author

Peter deHaan

Peter deHaan currently works for Adobe on the Flex SDK QA team. While not working on Flex, Flash, and ColdFusion applications, Peter enjoys making up bios and writing in 3rd person. Peter's rarely updated blog can be found at blogs.adobe.com/pdehaan/, actionscriptexamples.com, airexamples.com, and coldfusionexamples.com.

8 Responses to Setting a Flex Pie Chart’s start angle

  1. Val says:

    Hi,
    Thanks for this example.
    I use pie chart in my application, is there a way to have a semi pie chart ?
    Val

  2. Hi,
    Thanks for this example.
    I use pie chart in my application, is there a way to have a semi pie chart ?
    Val

  3. Anonymous says:

    can make it a 3D style?

  4. peterd says:

    Anonymous,

    I don’t believe that the Adobe Flex Charting components do 3D, but there are 3rd party components that offer 3D. For example, check out the ILOG Elixir components at http://www.ilog.com/products/ilogelixir/features/3d-charts/ .

    Peter

  5. Boyama Oyunları says:

    Does this work for you?

  6. mario oyunları says:

    can make it a 3D style?

  7. Boyama says:

    Thanks . For the information.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Anti-Spam Protection by WP-SpamFree