First effect, the effect of a reference to a foreign pie chart, but his code, comments, etc. I also can not understand, English do not understand, so I write a Chinese good. You can completely change the results according to my code.
The programming level is limited, everybody understands, but can run normally.
http://www.yes028.com/amu/ok.swf
XML configuration files are added to directly modify the XML file for direct use purposes.
The default data source is Piedata.xml but you can modify the data source in the page.
As follows:
<object classid= "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase= "http://download.macromedia.com/pub/ shockwave/cabs/flash/swflash.cab#version=7,0,19,0 "width=" height= ">"
<param name= "movie" value= "Ok.swf?piedata=piedata.asp"/>
<param name= "Quality" value= "High"/>
<embed src= "ok.swf?piedata=piedata.asp" quality= "High" pluginspage= "http://www.macromedia.com/go/" Getflashplayer "type=" Application/x-shockwave-flash "width=" "height=" ></embed>
</object>
Add parameters to the SWF file name in your code? Piedata=piedata.asp You can modify the data source to piedata.asp.
The code can not be issued once, the following replies to send.
Copy Code code as follows:
Scaling the stage does not scale the content, positioning the content in the upper-left corner of the stage;
Stage.align = "TL";
Stage.scalemode = "Noscale";
_quality = "best";
Import Mx.transitions.Tween;
Import mx.transitions.easing.*;
Global
All data
var pie_num:string = "20,15,8,50,55,100,100,190";
All data names
var pie_name:string = "Sichuan, Chongqing, Yunnan, Guizhou, Shanxi, Hunan, Shanghai, Beijing, Guangzhou";
Whether to display the data name and percent value
var show_name:string = "True,false,false,true,false,true,true,true"
All colors
var colorstr:string = "0xff0f00,0xff6600,0xff9e01,0xfcd202,0xf8ff01,0xb0de09,0x04d215,0x0d8ecf,0xff1f11";
All start positions
var defaultsate:string = "False,false,false,false,false,false,false,true";
Public variables
x0 = 210;//dot coordinate x (number)
y0 = 135;//dot coordinate y (number)
z = 150;//Round long axis (>0)
D = 90;//Round short axis (>0)
W = 150;//ring width (>0,< long axis)
H = 20;//cake height (>=0)
Movew = 15;//Move distance (>0)
Alpha = 100;//After click Transparency (0-100)
Mcalpha = 100;//Default all start transparency (0-100)
Showorder = true;//Whether to display the vertical arrangement table (True,false)
Orderx = 400;//vertical permutation table start x (number)
Ordery = 70;//vertical permutation table start y (number)
Orderxy = 6;//vertical interval (>0)
LineColor = 0xcccccc;//indicator line Color (hexadecimal color)
Linealpha = 100;//Indicator Line Transparency (0-100)
Titleline = 20; Indicator line Length (>0 | | 0<)
fontcolor = 0xff0000;//text color (hexadecimal color)
percentshow = "Font";/whether display hundred score four values (font text, Num hundred score, all show, none is not visible)
Orderfontcolor = 0x222222;//Left vertical arrange text color (hexadecimal color)
Dark = 1.43;//Dark factor (>1 as 1.43 default)
The following is a sample of three pie illustrations
The first argument is the movie name, and the second is the depth group.
Drawpie ("Amu", 1,
Pie_num,pie_name,titleline,linecolor,linealpha,orderfontcolor,percentshow,fontcolor,colorstr,defaultsate,show_ Name
X0,y0,z,d,w,h,movew,alpha,mcalpha,dark,
SHOWORDER,ORDERX,ORDERY,ORDERXY);
Drawpie ("Vapr", 2,
"15,30,60,90", "<b> good </b> bad, general, poor, too bad", 0,0xcccccc,0,0x000000, "All", 0x666666, "0x0d8ecf,0x04d215, 0xb0de09,0xf8ff01,0xff9e01,0xff6600,0xff1f11 "," True,true,false,false "," True,true,true,false ",
160,380,70,70,50,2,15,100,100,1.5,
TRUE,20,340,13);
Drawpie ("Kiss", 3,
"30,50,290,70,50,10", "flash,html,javascript,asp,php,c#", 10,0x999999,100,0x000000, "None", 0xff6600, "0x0D8ECF, 0x04d215,0xb0de09,0xf8ff01,0xff9e01,0xff6600,0xff1f11 "," False,false,false,false,false,false,false "," false, False,false,false,false,false,false ",
470,300,100,60,60,20,15,50,100,1.15,
FALSE,280,250,28);
Drawpie ("Kisss", 4,
"242,332,171,116,106,224", "flash,html,javascript,asp,php,c#", 10,0x999999,100,0x000000, "All", 0xff6600, "0x0D8ECF , 0x04d215,0xb0de09,0xf8ff01,0xff9e01,0xff6600,0xff1f11 "," False,false,false,false,false,false,false "," true,true , True,true,true,true,true ",
370,520,60,40,40,10,15,50,100,1.15,
true,515,480,3);
function Drawpie (mcname:string, Depth:number,
Pie_num:string, Pie_name:string, Titleline:number, Linecolor:number,linealpha:number, Orderfontcolor:Number, Percentshow:string, Fontcolor:number, colorstr:string, defaultsate:string, show_name:string,
X0:number, Y0:number, Z:number, D:number, W:number, H:number, Movew:number, Alpha:number, Mcalpha:number, Dark:Number,
Showorder:boolean, Orderx:number, Ordery:number, orderxy:number): void{
Arr_n = Pie_num.split (",");
arr_total=0;
for (m=0;m<arr_n.length;m++) {
Arr_total+=number (Arr_n[m]);
}
var arr_name = new Array ();
Arr_name = Pie_name.split (",");
var arr_showname = new Array ();
Arr_showname = Show_name.split (",");
var arr_num = new Array ();
var arr_percent = new Array ();
duof = 0;
for (m=0;m<arr_n.length;m++) {
if (m==arr_n.length-1) {
Duo = 360-duof;
Arr_num[m]= duo.tostring ();
}else{
Duo = Math.Round ((number (arr_n[m)) *360)/arr_total);
Duof = Duof+duo;
Arr_num[m]= duo.tostring ();
}
Arr_percent[m] = Math.Round ((number (arr_n[m)) *100)/arr_total*100)/100;
}
Split data
var arr_color = Colorstr.split (",");
var arr_defaultstate = Defaultsate.split (",");
The middle of all the fan rings
var arr_middle:array = new Array ();
Generates the intermediate degrees of all the fan rings to determine the depth
var xx:number=-90;
var arr_a:array = new Array ()//record the start and end of each sector
for (m=0; m<arr_num.length;m++) {
A0=xx;
A=number (a0) +number (Arr_num[m]);
Arr_a.push ([a0,a]);
Xx=a;
if (a-a0>180) {
Arr_middle[m] = 0.001;
}else{
if ((a-a0)/2+a0<=180 && (a-a0)/2+a0>=0) {
The middle angle of the MC and the difference of 90 degrees (here we determine who is the lowest absolute value of the 90 degree difference)
Arr_middle[m] = Math.Abs (90-(a-a0)/2+a0));
}else if ((a-a0)/2+a0>180 && (a-a0)/2+a0<=270) {
Arr_middle[m] = (Math.Abs (a-a0)/2+a0-180) +500);
The middle angle of the MC and the difference of 180 degrees (here we determine who and the absolute value of the 90 degree difference is the largest in front)
}else if ((a-a0)/2+a0>=-90 && (a-a0)/2+a0<0) {
Arr_middle[m] = (Math.Abs (a-a0)/2+a0-360) +500);
The middle angle of the MC and the difference of 270 degrees (here we determine who and the absolute value of the 90 degree difference is the largest in front)
}
}
Trace (m+ ":" +arr_middle[m]);
}
Trace (arr_a[0][0]);
Sector-Ring sorting
Arr_middle = Arr_middle.sort (array.numeric| Array.returnindexedarray);//reorder, so that the original array values from small to large, but the index of the array does not change.
Arr_middle.reverse ();
//
for (m = 0; m<arr_middle.length; m++) {
Draw a vertical square link------------------------------------------------------------------------
if (Showorder) {
_root.createemptymovieclip (mcname+arr_middle[m]+ "ICON_MC", (5-m) *22+depth*10+1);
MC = this[mcname+arr_middle[m]+ "ICON_MC"];
color = parseint (Arr_color[arr_middle[m]]);
BeginX = Orderx;
BeginY = Ordery;
Jianxy = orderxy+12;
Mc.beginfill (color, 100);
Mc.linestyle (1, Darkcolor (Color,dark), M, True, "none");
Mc.moveto (Beginx,arr_middle[m]*jianxy+beginy);
Mc.lineto (Beginx+12,arr_middle[m]*jianxy+beginy);
Mc.lineto (BEGINX+12,ARR_MIDDLE[M]*JIANXY+BEGINY+12);
Mc.lineto (BEGINX,ARR_MIDDLE[M]*JIANXY+BEGINY+12);
Mc.endfill ();
var Label:textfield = Mc.createtextfield ("label", 1, beginx+16, arr_middle[m]*jianxy+beginy-3, 0, 0);
Label.html = true;
Label.autosize = "Left";
Label.htmltext = Arr_name[arr_middle[m]];
var myformat:textformat = new TextFormat ();
Myformat.font = "Verdana";
Myformat.size = 12;
Myformat.color = Orderfontcolor;
Label.settextformat (MyFormat);
}
//---------------------------------------------------------------------
_root.createemptymovieclip (mcname+arr_middle[m]+ "_MC", (5-m) *22+depth*10);
Current m should be counted as arr_middle[m];
Drawcircle (this[mcname+arr_middle[m]+ "_MC"),
X0, y0, Z, D, Arr_a[arr_middle[m]][0], arr_a[arr_middle[m]][1], H, W, parseint (Arr_color[arr_middle[m]),
MOVEW,ALPHA,MCALPHA,ARR_DEFAULTSTATE[ARR_MIDDLE[M]],
ARR_PERCENT[ARR_MIDDLE[M]],ARR_NAME[ARR_MIDDLE[M]],ARR_SHOWNAME[ARR_MIDDLE[M]],
Titleline,linecolor,linealpha,fontcolor,percentshow,dark,
this[mcname+arr_middle[m]+ "ICON_MC"]);
this[mcname+arr_middle[m]+ "_MC"]._ALPHA=MCALPHA;
//---------------------------------------------------------------------
The effect of clicking the vertical arrangement is the same as when you click Pie.
if (Showorder) {
Mc.onrelease = this[mcname+arr_middle[m]+ "_MC"].onrelease;
}
}
}
Current 1/2 page
12 Next read the full text