Chart With Style
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Style>
@namespace mx "http://www.adobe.com/2006/mxml";
mx|ColumnChart {
fontFamily:Georgia;
fontSize:18;
color: #0000FF;
chartSeriesStyles: mySeries1, mySeries2;
}
.mySeries1 {
fill: #D2691E;
}
.mySeries2 {
fill: #0000CD;
}
</mx:Style>
<mx:Script>
import mx.collections.ArrayCollection;
[Bindable]
public var myArray:ArrayCollection = new ArrayCollection([
{Country:"A", GDP:11},
{Country:"B", GDP:22},
{Country:"C", GDP:33},
{Country:"D", GDP:44}
]);
[Bindable]
public var myArray2:ArrayCollection = new ArrayCollection([
{Country:"A", GDP:33},
{Country:"B", GDP:22},
{Country:"C", GDP:11},
{Country:"D", GDP:44}
]);
</mx:Script>
<mx:Panel title="Column Chart">
<mx:ColumnChart id="myChart" dataProvider="{myArray}" showDataTips="true">
<mx:horizontalAxis>
<mx:CategoryAxis categoryField="Country"/>
</mx:horizontalAxis>
<mx:series>
<mx:ColumnSeries
dataProvider="{myArray}"
yField="GDP"
xField="Country"
displayName="Array"
/>
<mx:ColumnSeries
dataProvider="{myArray2}"
yField="GDP"
xField="Country"
displayName="Array2"
/>
</mx:series>
</mx:ColumnChart>
<mx:Legend dataProvider="{myChart}"/>
</mx:Panel>
</mx:Application>
Related examples in the same category