Flex中如何创建clustered, stacked, overlaid以及100% Bar charts(图表)

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white" viewSourceURL="srcview/index.html">

    <mx:ApplicationControlBar dock="true">
        <mx:Form>
            <mx:FormItem label="type:">
                <mx:ComboBox id="comboBox">
                    <mx:dataProvider>
                        <mx:Object label="clustered" />
                        <mx:Object label="stacked" />
                        <mx:Object label="100%" />
                        <mx:Object label="overlaid" />
                    </mx:dataProvider>
                </mx:ComboBox>
            </mx:FormItem>
            <mx:FormItem label="showDataTips:">
                <mx:CheckBox id="checkBox1" />
            </mx:FormItem>
            <mx:FormItem label="showAllDataTips:">
                <mx:CheckBox id="checkBox2" />
            </mx:FormItem>
        </mx:Form>

        <mx:Spacer width="100%" />

        <mx:Legend dataProvider="{barChart}"/>
    </mx:ApplicationControlBar>

    <mx:BarChart id="barChart"
            type="{comboBox.selectedItem.label}"
            showDataTips="{checkBox1.selected}"
            showAllDataTips="{checkBox2.selected}"
            height="100%"
            width="100%">

        <mx:dataProvider>
            <mx:Array>
                <mx:Object name="R Winn" obp=".353" slg=".445" avg=".300" />
                <mx:Object name="P Feliz" obp=".290" slg=".418" avg=".253" />
                <mx:Object name="O Vizquel" obp=".305" slg=".316" avg=".246" />
                <mx:Object name="B Molina" obp=".298" slg=".433" avg=".276" />
                <mx:Object name="R Durham" obp=".295" slg=".343" avg=".218" />
            </mx:Array>
        </mx:dataProvider>

        <mx:verticalAxis>
            <mx:CategoryAxis categoryField="name"/>
        </mx:verticalAxis>

        <mx:series>
            <mx:BarSeries yField="name" xField="obp" displayName="OBP"/>
            <mx:BarSeries yField="name" xField="slg" displayName="SLG"/>
            <mx:BarSeries yField="name" xField="avg" displayName="AVG"/>
        </mx:series>
    </mx:BarChart>

</mx:Application>

 

你可能感兴趣的:(html,xml,Flex,Adobe)