+展开-XML
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="horizontal" backgroundColor="0xFFFFFF">
<mx:Script>
<![CDATA[
// a basic data set
[Bindable] public var chartDP:Array = [
{day:'Monday',rainfall:10,elevation:100,temperature:78},
{day:'Tuesday',rainfall:7,elevation:220,temperature:66},
{day:'Wednesday',rainfall:5,elevation:540,temperature:55},
{day:'Thursday',rainfall:8,elevation:60,temperature:84},
{day:'Friday',rainfall:11,elevation:390,temperature:52},
{day:'Saturday',rainfall:12,elevation:790,temperature:45},
{day:'Sunday',rainfall:14,elevation:1220,temperature:24}
];
]]>
</mx:Script>
<mx:ToggleButtonBar dataProvider="{simpleCharts}"
direction="vertical" />
<mx:ViewStack id="simpleCharts" >
<mx:Canvas label="Bar">
<mx:BarChart dataProvider="{chartDP}" >
<mx:verticalAxis>
<mx:CategoryAxis
dataProvider="{chartDP}"
categoryField="day" />
</mx:verticalAxis>
<mx:series>
<!-- bar chart uses a BarSeries -->
<mx:BarSeries
yField="day" xField="rainfall"
displayName="day" />
</mx:series>
</mx:BarChart>
</mx:Canvas>
<mx:Canvas label="Pie">
<mx:PieChart dataProvider="{chartDP}" >
<!-- no axes need to be defined in a pie chart -->
<mx:series>
<!-- pie chart uses a pie series -->
<mx:PieSeries
field="rainfall"
nameField="day"
labelPosition="callout"
displayName="rainfall" />
</mx:series>
</mx:PieChart>
</mx:Canvas>
</mx:ViewStack>
</mx:Application>