Setting a Flex Pie Chart’s start angle

by Peter deHaan on September 24, 2007

in Charting, PieChart, PieSeries

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)“.

View MXML

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/09/24/setting-a-flex-pie-charts-start-angle/ -->
<mx:Application 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.

{ 6 comments… read them below or add one }

1 Val September 25, 2007 at 2:11 am

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

Reply

2 zeka oyunları May 1, 2008 at 12:15 pm

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

Reply

3 peterd May 1, 2008 at 1:04 pm
4 Anonymous August 19, 2008 at 8:48 pm

can make it a 3D style?

Reply

5 peterd August 19, 2008 at 9:01 pm

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

Reply

6 Boyama Oyunları September 24, 2008 at 1:47 pm

Does this work for you?

Reply

Leave a Comment

Sorry, this blog is terrible at eating HTML comments.
If you're pasting any HTML/XML/MXML code, you need to convert your < characters to &lt; and your > characters to &gt; .

You can 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

Previous post:

Next post: