<script language="JavaScript">
//参数含义(数组,横坐标,纵坐标,图表的宽度,图表的高度,图表标题,单位)
function vml3DCake(stat_array,valueInfo,table_left,table_top,all_width,all_height,table_title,unit)
{
var bgColorInfo=["#ff1919","#ffff19","#1919ff","#19ff19","#ffcc00","#32cccc","#ff19ff","#993300","#ff6600","#ff8c19"];
var pie=["","","","","","","","","",""];
var num,allvalues,k,i,k1,k2,k3,k4,k5,R,kkk,txt_x,txt_y;
var vmlStr="";
//设置颜色
//得到有多少条信息成饼状图
num =valueInfo.length;
//求所有数值的总合
allvalues=0;
for(i=0;i<num;i++){
allvalues = allvalues+valueInfo[i];
}
k=1;
//求百分比
for(i=0;i<num-1;i++){
pie[i] = ((valueInfo[i])/allvalues).toFixed(4) ;
k=k-pie[i];
}
pie[num-1]=k.toFixed(4);
vmlStr+= "<v:shapetype id='Cake_3D' coordsize='21600,21600' o:spt='95' adj='11796480,5400' path='al10800,10800@0@0@2@14,10800,10800,10800,10800@3@15xe'></v:shapetype>"
//基本没啥用处
vmlStr+= "<v:shapetype id='3dtxt' coordsize='21600,21600' o:spt='136' adj='10800' path='m@7,l@8,m@5,21600l@6,21600e'> "
vmlStr+= " <v:path textpathok='t' o:connecttype='custom' o:connectlocs='@9,0;@10,10800;@11,21600;@12,10800' 'o:connectangles='270,180,90,0'/>"
vmlStr+= " <v:textpath on='t' fitshape='t'/>"
vmlStr+= " <o:lock v:ext='edit' text='t' shapetype='t'/>"
vmlStr+= "</v:shapetype>"
//外边框
vmlStr+= "<v:rect id='background' style='position:absolute;left:"+ table_left +"px;top:"+ table_top +"px;WIDTH:"+ all_width +"px;HEIGHT:"+ all_height +"px;' fillcolor='#EFEFEF' strokecolor='gray'>"
vmlStr+= " <v:shadow on='t' type='single' color='silver' offset='4pt,4pt'/>"
vmlStr+= "</v:rect>"
//文头和信息区域
vmlStr+= "<v:group ID='table' style='position:absolute;left:"+ table_left +"px;top:"+ table_top +"px;WIDTH:"+ all_width +"px;HEIGHT:"+ all_height +"px;' coordsize = '21000,11500'>"
vmlStr+= " <v:Rect style='position:relative;left:500;top:200;width:20000;height:800'filled='false' stroked='false'>"
vmlStr+= " <v:TextBox inset='0pt,0pt,0pt,0pt'>"
vmlStr+= " <table width='100%' border='0' align='center' cellspacing='0'>"
vmlStr+= " <tr>"
vmlStr+= " <td align='center' valign='middle'><div style='font-size:15pt; font-family:黑体;'><B>"+ table_title +"</B></div></td>"
vmlStr+= " </tr>"
vmlStr+= " </table>"
vmlStr+= " </v:TextBox>"
vmlStr+= " </v:Rect> "
//背景
vmlStr+= " <v:rect id='back' style='position:relative;left:500;top:1000;width:20000; height:10000;' onmouseover='movereset(1)' onmouseout='movereset(0)' fillcolor='#9cf' strokecolor='#888888'>"
vmlStr+= " <v:fill rotate='t' angle='-45' focus='100%' type='gradient'/>"
vmlStr+= " </v:rect>"
//背景
vmlStr+= " <v:rect id='back' style='position:relative;left:15000;top:1400;width:5000; height:"+ ((num+1)*9000/11+200) +";' fillcolor='#9cf' stroked='t' strokecolor='#0099ff'>"
vmlStr+= " <v:fill rotate='t' angle='-175' focus='100%' type='gradient'/>"
vmlStr+= " <v:shadow on='t' type='single' color='silver' offset='3pt,3pt'/>"
vmlStr+= " </v:rect>"
//总数
vmlStr+= " <v:Rect style='position:relative;left:15500;top:1500;width:4000;height:700' fillcolor='#000000' stroked='f' strokecolor='#000000'>"
vmlStr+= " <v:TextBox inset='8pt,4pt,3pt,3pt' style='font-size:11pt;'><div align='left'><font color='#ffffff'><B>总数:"+ allvalues + unit +"</B></font></div></v:TextBox>"
vmlStr+= " </v:Rect> "
//具体信息区
for(i=0;i<num;i++){
var topInfo=2500+i*800;
vmlStr+= " <v:Rect id='rec"+ i +"' style='position:relative;left:15400;top:"+ topInfo +";width:4300;height:800;display:none' fillcolor='#efefef' strokecolor='"+ bgColorInfo[i] +"'>"
vmlStr+= " <v:fill opacity='.6' color2='fill darken(118)' o:opacity2='.6' rotate='t' method='linear sigma' focus='100%' type='gradient'/>"
vmlStr+= " </v:Rect>"
vmlStr+= " <v:Rect style='position:relative;left:15500;top:"+ topInfo +";width:600;height:700' fillcolor='"+ bgColorInfo[i] +"' stroked='f'/>"
vmlStr+= " <v:Rect style='position:relative;left:16300;top:"+ topInfo+";width:3400;height:700' filled='f' stroked='f'>"
vmlStr+= " <v:TextBox inset='0pt,5pt,0pt,0pt' style='font-size:9pt;'><div align='left'>"+ stat_array[i] +":"+ valueInfo[i] + unit +"</div></v:TextBox>"
vmlStr+= " </v:Rect> "
vmlStr+= " </v:Rect> "
}
vmlStr+= "</v:group>"
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//开始画饼区域
//
//
//
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
k1 = 180 //开始的度数
k4 = 10
for(i=0;i<num;i++){
k2 = 360 * pie[i]/2
k3 = k1 + k2 //结束的度数
if (k3 >= 360) {
k3 = k3 - 360
}
kkk = (-11796480*pie[i]+5898240)
k5 = 3.1414926*2*(180-(k3-180))/360
R = all_height/2
txt_x = table_left+all_height/8-30+R+R*Math.sin(k5)*0.7
txt_y = table_top+all_height/14-39+R+R*Math.cos(k5)*0.7*0.5
var pieInfo=( pie[i]*100).toFixed(2);
titlestr = "名 称:"+ stat_array[i] +"数 值:"+ valueInfo[i] + unit +"所占比例:"+ pieInfo +"% "
vmlStr+= " <div style='cursor:hand;'>"
vmlStr+= " <v:shape id='cake"+ i +"' type='#Cake_3D' title='"+ titlestr +"'"
vmlStr+= " style='position:absolute;left:"+ (table_left+all_height/8) +"px;top:"+ (table_top+all_height/14) +"px;WIDTH:"+ all_height +"px;HEIGHT:"+ all_height +"px;rotation:"+ k3 +";z-index:"+ k4 +"'"
vmlStr+= " adj='"+ kkk +",0' fillcolor='"+ bgColorInfo[i] +"' onmouseover='moveup(cake"+ i +","+ (table_top+all_height/14) +",txt"+ i +",rec"+ i +")'; onmouseout='movedown(cake"+ i +","+ (table_top+all_height/14) +",txt"+ i +",rec"+ i +");'>"
vmlStr+= " <v:fill opacity='60293f' color2='fill lighten(120)' o:opacity2='60293f' rotate='t' angle='-135' method='linear sigma' focus='100%' type='gradient'/>"
vmlStr+= " <o:extrusion v:ext='view' on='t'backdepth='25' rotationangle='60' viewpoint='0,0'viewpointorigin='0,0' skewamt='0' lightposition='-50000,-50000' lightposition2='50000'/>"
vmlStr+= " </v:shape>"
vmlStr+= " <v:shape id='txt"+ i +"' type='#3dtxt' style='position:absolute;left:"+ txt_x +"px;top:"+ txt_y +"px;z-index:20;display:none;width:50; height:18;' fillcolor='#ffffff'"
vmlStr+= " onmouseover='ontxt(cake"+ i +","+ (table_top+all_height/14) +",txt"+ i +",rec"+ i +")'>"
vmlStr+= " <v:fill opacity='60293f' color2='fill lighten(120)' o:opacity2='60293f' rotate='t' angle='-135' method='linear sigma' focus='100%' type='gradient'/>"
vmlStr+= " <v:textpath style='font-family:'宋体';v-text-kern:t' trim='t' fitpath='t' string='"+ pieInfo +"%'/>"
vmlStr+= " <o:extrusion v:ext='view' backdepth='8pt' on='t' lightposition='0,0' lightposition2='0,0'/>"
vmlStr+= " </v:shape>"
vmlStr+= " </div>"
k1 = k1+k2*2
if (k1>=360){
k1 =k1-360
}
if(k1>180){
k4 =k4+1
}else{
k4 =k4-1
}
}
document.writeln(vmlStr);
}
</script>
<SCRIPT LANGUAGE="JavaScript">
<!--
var onit=true
var num=0
var onstep = 10
function moveup(iteam,top,txt,rec){
temp=eval(iteam)
tempat=eval(top)
temptxt=eval(txt)
temprec=eval(rec)
at=parseInt(temp.style.top)
temprec.style.display = "";
if (num>onstep){
temptxt.style.display = "";
}
if(at>(tempat-onstep-1)&&onit){
num++
temp.style.top=at-1
Stop=setTimeout("moveup(temp,tempat,temptxt,temprec)",10)
}else{
return
}
}
function movedown(iteam,top,txt,rec){
temp=eval(iteam)
temptxt=eval(txt)
temprec=eval(rec)
clearTimeout(Stop)
temp.style.top=top
num=0
temptxt.style.display = "none";
temprec.style.display = "none";
}
function ontxt(iteam,top,txt,rec){
t
pai.rar_饼图
版权申诉
3 浏览量
2022-09-20
16:11:13
上传
评论
收藏 3KB RAR 举报
御道御小黑
- 粉丝: 61
- 资源: 1万+
最新资源
- 基于Arduino Nano的红外循迹小车源码(高分课设).zip
- 将MS SQL数据库表里的数据内容生成SQL执行语句
- 基于MATLAB的钢板表面缺陷检测系统
- MS SQL里生成行政区域县区信息表和相应数据
- delphi实现DBGrid全选和反选功能
- 25C11F41-2B2A-4D1A-AAA8-7C654526B129.pdf
- Android Studio Jellyfish(android-studio-2023.3.1.18-cros.deb)
- MVC+EF框架+EasyUI实现权限管理源码程序
- python第66-75天,Day66-75.rar
- python后端服务project-of-tornado.rar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
评论0