<? XML version = "1.0" encoding = "UTF-8"?>
<Mx: Application xmlns: MX = "http://www.adobe.com/2006/mxml" layout = "absolute" width = "100%" Height = "100%">
<Mx: SCRIPT>
<! [CDATA [
Import MX. Collections. arraycollection;
Import MX. Controls. Alert;
// Data source of the column chart and pie chart
[Bindable]
Private var medalsac: arraycollection = new arraycollection
(
[{Country: "USA", gold medal: 35, silver medal: 39, bronze medal: 29 },
{Country: "China", gold medal: 88, silver medal: 17, bronze medal: 14 },
{Country: "UK", gold medal: 27, silver medal: 27, bronze medal: 38}]);
[Bindable]
Private var lines: arraycollection = new arraycollection ([
{Month: "January", profit: 2000, consumption: 1500, quantity: 450 },
{Month: "February", profit: 1000, consumption: 200, quantity: 600 },
{Month: "March", profit: 1500, consumption: 500, quantity: 300 },
{Month: "April", profit: 1800, consumption: 1200, quantity: 900 },
{Month: "May", profit: 2400, consumption: 575, quantity: 500 },
{Month: "June", profit: 2587, consumption: 567, quantity: 555 },
{Month: "July", profit: 1687, consumption: 945, quantity: 452 },
{Month: "August", profit: 5210, consumption: 867, quantity: 510 },
{Month: "September", profit: 6777, consumption: 298, quantity: 421 },
{Month: "October", profit: 8765, consumption: 986, quantity: 5554 },
{Month: "November", profit: 3456, consumption: 1789, quantity: 854 },
{Month: "December", profit: 6533, consumption: 845, quantity: 1200 },
]);
// Pie chart callback Method
Private function displaygold (data: object, field: String, index: Number, percentvalue: Number): String {
VaR temp: String = ("" + percentvalue). substr (0, 6 );
Return data. Country + ":" + '/N' + "gold medal:" + data. Gold medal + "/N" + temp + "% ";
}
]>
</MX: SCRIPT>
<! -- Internal identifier color -->
<Mx: solidcolor id = "SC1" color = "yellow" alpha = ". 8"/>
<Mx: solidcolor id = "SC2" color = "0 xcccccc" alpha = ". 6"/>
<Mx: solidcolor id = "SC3" color = "0xffcc66" alpha = ". 6"/>
<! -- Mark border color -->
<Mx: stroke id = "S1" color = "yellow" Weight = "2"/>
<Mx: stroke id = "S2" color = "0 xcccccc" Weight = "2"/>
<Mx: stroke id = "S3" color = "0xffcc66" Weight = "2"/>
<! -- =============================== Bar chart ================================-->
<Mx: columnchart x = "21" Y = "74" id = "chart" Height = "237" dataprovider = "{medalsac}" fontsize = "12" width = "295">
<Mx: horizontalaxis>
<Mx: categoryaxis categoryfield = "country"/>
</MX: horizontalaxis>
<Mx: Series>
<Mx: columnseries xfield = "country" yfield = "Gold Medal" displayname = "Gold Medal" fill = "{SC1}" stroke = "{S1}"/>
<Mx: columnseries xfield = "country" yfield = "" displayname = "" fill = "{SC2}" stroke = "{S2}"/>
<Mx: columnseries xfield = "country" yfield = "Bronze" displayname = "Bronze" fill = "{SC3}" stroke = "{S3}"/>
</MX: Series>
</MX: columnchart>
<Mx: Legend dataprovider = "{chart}" x = "334" Y = "91" fontsize = "12" Height = "103"/>
<! -- ============================== Pie chart =============================-->
<! -- Pie chart prompt style -->
<Mx: stroke id = "callouts" Weight = "2" color = "red" alpha = ". 9" Caps = "square"/>
<! -- Pie chart split line style -->
<Mx: stroke id = "RADIAL" Weight = "1" color = "gray" alpha = ". 6"/>
<! -- Pie chart circular border style -->
<Mx: stroke id = "pieborder" color = "blue" Weight = "2" alpha = ". 5"/>
<Mx: piechart id = "pchart"
Height = "284"
Width = "387"
Showdatatips = "true"
Dataprovider = "{medalsac }"
X = "451" Y = "50" fontsize = "12" type = "regxph" text = "yourobjectname">
<! -- Fills: fill color of the pie chart; labelposition: Drawing prompt -->
<Mx: Series>
<Mx: pieseries namefield = "country" labelposition = "callout"
Field = "Gold Medal" labelfunction = "displaygold"
Calloutstroke = "{callouts}" radialstroke = "{radial}" stroke = "{pieborder}" fills = "{[SC1, SC2, SC3]}">
<Mx: Filters>
<Mx: array/>
</MX: Filters>
</MX: pieseries>
</MX: Series>
</MX: piechart>
<Mx: Legend dataprovider = "{pchart}" x = "870" Y = "137" Height = "97" fontsize = "12"/>
<! -- =============== Graph ============================================-->
<Mx: linechart x = "21" Y = "342" id = "linechart" width = "693" Height = "273" dataprovider = "{lines}" fontsize = "12">
<Mx: horizontalaxis>
<Mx: categoryaxis categoryfield = "month"/>
</MX: horizontalaxis>
<Mx: Series>
<Mx: lineseries yfield = "profit" form = "curve" displayname = "profit" linestroke = "{S1}"/>
<Mx: lineseries yfield = "consumption" form = "curve" displayname = "consumption" linestroke = "{S2}"/>
<Mx: lineseries yfield = "quantity" form = "curve" displayname = "quantity" linestroke = "{S3}"/>
</MX: Series>
</MX: linechart>
<Mx: Legend dataprovider = "{linechart}" x = "121" Y = "623" width = "282" Height = "37" fontsize = "12"/>
</MX: Application>