<?xml version="1.0"?>
<!-- 縦棒グラフと横棒グラフの使用方法を示す簡単な例 -->
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" backgroundColor="#FFFFFF">
<mx:Script>
<![CDATA[
var Medals = [{Country:"USA", Gold:35, Silver:39, Bronze: 29},
{Country:"China", Gold:32, Silver:17, Bronze: 14},
{Country:"Russia", Gold:27, Silver:27, Bronze: 38}
]
]]>
</mx:Script>
<mx:Panel title="Column and Bar Chart Panel" height="100%" width="100%">
<mx:HBox height="100%" width="100%">
<mx:ColumnChart id="column" marginLeft="5" height="100%"
width="45%" marginRight="5" dataProvider="{Medals}" showDataTips="true">
<mx:horizontalAxis>
<mx:CategoryAxis dataProvider="{Medals}" categoryField="Country"/>
</mx:horizontalAxis>
<mx:series>
<mx:Array>
<mx:ColumnSeries xField="Country" yField="Gold" name="Gold"/>
<mx:ColumnSeries xField="Country" yField="Silver" name="Silver"/>
<mx:ColumnSeries xField="Country" yField="Bronze" name="Bronze"/>
</mx:Array>
</mx:series>
</mx:ColumnChart>
<mx:Legend dataProvider="column"/>
<mx:BarChart id="bar" marginLeft="5" height="100%"
width="45%" marginRight="5" dataProvider="{Medals}" showDataTips="true">
<mx:verticalAxis>
<mx:CategoryAxis dataProvider="{Medals}" categoryField="Country"/>
</mx:verticalAxis>
<mx:series>
<mx:Array>
<mx:BarSeries yField="Country" xField="Gold" name="Gold"/>
<mx:BarSeries yField="Country" xField="Silver" name="Silver"/>
<mx:BarSeries yField="Country" xField="Bronze" name="Bronze"/>
</mx:Array>
</mx:series>
</mx:BarChart>
<mx:Legend dataProvider="bar"/>
</mx:HBox>
</mx:Panel>
</mx:Application>
|