用FLASH画超炫3D立体饼图

合集下载
相关主题
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

用FLASH画3D立体饼图

先看效果图:

方法如下:

新建一FLASH文档,在第一个空白关键帧粘贴以下代码即可(100%如效果图所示):

修改数据:找到var pie_num:String = "20,15,8,50,55,100,100,190";这一行可以修改数据。

修改标注名称:找到var pie_name:String = "四川,重庆,云南,贵州,山西,湖南,上海,北京,广州"; 这一行可以修改标注。

Stage.align = "TL";

Stage.scaleMode = "noScale";

_quality = "BEST";

import mx.transitions.Tween;

import mx.transitions.easing.*;

//全局

//所有数据

var pie_num:String = "20,15,8,50,55,100,100,190";

//所有数据名称

var pie_name:String = "四川,重庆,云南,贵州,山西,湖南,上海,北京,广州";

//是否显示数据名称与百分比值

var show_name:String = "true,false,false,true,false,true,true,true"

//所有颜色

var colorstr:String = "0xFF0F00,0xFF6600,0xFF9E01,0xFCD202,0xF8FF01,0xB0DE09,0x04D215,0x0D8ECF,0xFF1 F11";

//所有开始位置

var defaultsate:String = "false,false,false,false,false,false,false,true";

//公共变量

x0 = 210;//圆点坐标x(数字)

y0 = 135;//圆点坐标y(数字)

z = 150;//圆长轴(>0)

d = 90;//圆短轴(>0)

w = 150;//环宽(>0,<长轴)

h = 20;//饼高(>=0)

movew = 15;//移动距离(>0)

alpha = 100;//点击之后的透明度(0-100)

mcalpha = 100;//默认所有开始透明度(0-100)

showorder = true;//是否显示竖向排列表(true,false)

orderx = 400;//竖向排列表起始x(数字)

ordery = 70;//竖向排列表起始y(数字)

orderxy = 6;//竖向排列表竖向间隔(>0)

linecolor = 0xcccccc;//指示线颜色(十六进制颜色)

linealpha = 100;//指示线透明度(0-100)

titleline = 20; //指示线长度(>0 || 0<)

fontcolor = 0xFF0000;//文字颜色(十六进制颜色)

percentshow = "font";//是否显示百分值四个值(font文字,num百分值,all都显示,none不显)orderfontcolor = 0x222222;//左边竖向排列文字颜色(十六进制颜色)

dark = 1.43;//深色系数(>1如1.43默认)

//以下为三个饼图示例

//第一个参数为影片名,第二个为深度群

drawpie("amu",1,

pie_num,pie_name,titleline,linecolor,linealpha,orderfontcolor,percentshow,fontcolor,colorstr,defau ltsate,show_name,

x0,y0,z,d,w,h,movew,alpha,mcalpha,dark,

showorder,orderx,ordery,orderxy);

drawpie("vapr",2,

"15,30,60,90",",不好,一般,差,太差了",0,0xcccccc,0,0x000000,"all",0x666666,"0x0D8ECF,0x04D215,0xB0DE09,0xF8FF01,0xFF9E0 1,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",0x ff6600,"0x0D8ECF,0x04D215,0xB0DE09,0xF8FF01,0xFF9E01,0xFF6600,0xFF1F11","false,fals e,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):V oid{

arr_n = pie_num.split(",");

arr_total=0;

for(m=0;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

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;

相关文档
最新文档