<?xml version="1.0" encoding="utf-8"?>
<Application xmlns="http://www.adobe.com/2006/mxml" viewSourceURL="srcview/index.html" 
    xmlns:qc="qs.charts.*" initialize="genData();">
    
    <Script>
        <![CDATA[
            [Bindable] public var dataSet:Array;
            public function genData():void
            {
                var d:Array = [];
                var count:int = 10 + Math.floor(Math.random()*5);
                for(var i:int=0;i<count;i++) {
                    d.push( {
                        costs: Math.floor(Math.random()*10),
                        revenue: 5 + Math.floor(Math.random()*10)
                    });                    
                }
                dataSet = d;
            }
        ]]>
    </Script>
    <Panel width="100%" height="100%" title="data based renderers"  layout="horizontal">
        <VBox height="100%">
            
        <Text width="300">
            <htmlText>
        <![CDATA[ This Pie Chart renders a second set of values as the size of each wedge.
        ]]>
        </htmlText>
        </Text>
        <Button label="change" click="genData()" />
        </VBox>
        <PieChart width="100%" height="100%" dataProvider="{dataSet}" >
            <series>
                <qc:SizedPieSeries field="costs" radiusField="revenue">
                    <qc:showDataEffect>
                        <SeriesInterpolate duration="700" elementOffset="0"/>
                    </qc:showDataEffect>
                </qc:SizedPieSeries>
            </series>
            <!-- as a Beta3 limitation, you need to explicitly assign a radialAxis before you can use it. This is fixed post beta3.
            -->
            <radialAxis>
                <LinearAxis autoAdjust="false" minimum="0" />
            </radialAxis>
        </PieChart>
    </Panel>
</Application>