Open GoogleCodeExporter opened 9 years ago
___________________________
flexPie.mxml (Sorry, we are not allowed to upload files)
____________________________
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="init();" applicationComplete="init1();">
<mx:Script>
<![CDATA[
import org.flex_pilot.FPBootstrap;
private function init1():void {
FPBootstrap.flex_pilotLibPath = 'FlexPilot.swf';
FPBootstrap.init(stage);
}
]]>
</mx:Script>
<mx:Script>
<![CDATA[
import mx.charts.ChartItem;
import mx.charts.HitData;
import mx.charts.chartClasses.Series;
import mx.charts.events.ChartItemEvent;
import mx.charts.series.PieSeries;
import mx.charts.series.items.*;
import mx.charts.series.items.ColumnSeriesItem;
import mx.collections.ArrayCollection;
import mx.collections.XMLListCollection;
import mx.controls.Alert;
import mx.effects.easing.*;
import mx.graphics.IFill;
import mx.graphics.SolidColor;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.utils.StringUtil;
[Bindable]
private var _precise:Object = new Object();
[Bindable]
private var _callData:XML ;
private var labelText:String;
private var xmlList:XMLList=new XMLList();
private var xmlListCollection:XMLListCollection=new XMLListCollection();
private var _selectedRegion:Object;
public function get selectedRegion():Object
{
return _selectedRegion;
}
public function get callData():XML
{
return _callData;
}
/**
*label(display the line besides piechart)
*/
private function display(data:Object, field:String, index:Number, percentValue:Number):String {
if(data.@data%7==0){
return data.@label + ": " + '\n' + numberFormatter.format(Math.round(Number(numberFormatter.format(percentValue)))) + "%";
}else{
return data.@label + ": " + '\n' + numberFormatter.format(percentValue) + "%";
}
}
/**
* shake effect by clicking mouse
*/
public function set selectedRegion(item:Object):void
{
_selectedRegion = item;
var index:int = -1;
for (var i:int=0; i < xmlListCollection.length && index == -1; i++)
{
if (xmlListCollection[i].@label == item.@label)
index = i;
}
var explodeData:Array = [];
explodeData[index] = 0.03;
chart.series[0].perWedgeExplodeRadius = explodeData;
}
private function regionChange(item:Object):void
{
selectedRegion = item;
dispatchEvent(new Event("regionChange"));
}
/**
* format data display
*/
private function formatDataTip(item:HitData):String
{
var cSI:PieSeriesItem = item.chartItem as PieSeriesItem;
var name:String = PieSeries(item.element).nameField;
var col:String = PieSeries(item.element).field;
if(cSI.item[col]%7==0){
return ""+cSI.item[name]+":"+cSI.item[col]+"\n"+ numberFormatter.format(Math.round(Number(numberFormatter.format(cSI.percentValue))))+"%";
}else{
return ""+cSI.item[name]+":"+cSI.item[col]+"\n"+ numberFormatter.format(cSI.percentValue)+"%";
}
}
Original comment by scottyan...@gmail.com
on 19 Oct 2011 at 5:52
___________________________
flexPie.html (Sorry, we are not allowed to upload files)
____________________________
<html>
<head>
<title>Login Page</title>
<style type="text/css" />
body {
background: white;
text-align: center;
}
#container {
width: 30em;
height: 15em;
margin: 5em auto;
background: white;
border: 1px solid gray;
}
</style>
<script type="text/javascript">
var testApp;
function init() {
var html = '';
var movieName = 'flexPie.swf';
if (navigator.appName == 'Microsoft Internet Explorer') {
html = '<object type="application/x-shockwave-flash" ' +
'width="100%" height="100%" id="flexPie">' +
'<param name="movie" value="' + movieName + '">' +
'</object>';
}
else {
html = '<embed id="flexPie" height="100%" width="100%"' +
'name="flexPie" src="' + movieName + '"' +
'type="application/x-shockwave-flash"/>';
}
document.getElementById('container').innerHTML = html;
}
window.onload = init;
</script>
</head>
<body>
<div id="container" style="width: 400px; height: 300px;" />
</body>
</html>
Original comment by scottyan...@gmail.com
on 19 Oct 2011 at 5:53
Original issue reported on code.google.com by
scottyan...@gmail.com
on 19 Oct 2011 at 5:52