为方便生成三维饼图函数,我收集了asp下的生成三维饼图的函数的代码,方便大家特殊情况下的使用
复制代码 代码如下:
<%
‘参数含义(数组,横坐标,纵坐标,图表的宽度,图表的高度,图表标题,单位)
function table2(stat_array,table_left,table_top,all_width,all_height,table_title,unit)
       dim bg_color(10),pie(10)
       bg_color(1)=”#ff1919″
       bg_color(2)=”#ffff19″
       bg_color(3)=”#1919ff”
       bg_color(4)=”#19ff19″
       bg_color(5)=”#fc0″
       bg_color(6)=”#3cc”
       bg_color(7)=”#ff19ff”
       bg_color(8)=”#993300″
       bg_color(9)=”#f60″
       bg_color(10)=”#ff8c19″
       num =ubound(stat_array,1)
       allvalues=0
       for i=1 to num
              allvalues = allvalues+stat_array(i,1)
       next
       k=0
       for i=1 to num-1
              pie(i)=formatnumber(stat_array(i,1)/allvalues,4,-1)
              k=k+pie(i)
       next
       pie(num)=formatnumber((1-k),4,-1)
       response.Write “”
       response.Write ” ”
       response.Write ” ”
       response.Write ” ”
       response.Write ” ”
       response.Write “”
       response.Write “”
       response.Write ” ”
       response.Write “”
       response.Write “” 
       response.Write ” ”
       response.Write ” ”
       response.Write ” 


       response.Write ” 


       response.Write ” 


       response.Write ” 


       response.Write ” 

“&table_title&”


       response.Write ” ”
       response.Write ”  ”
       response.Write ” ”
       response.Write ” ”
       response.Write ” ”
       response.Write ” ”
       response.Write ” ”
       response.Write ” ”
       response.Write ” ”
       response.Write ” ”
       response.Write ” 总数:”&allvalues&unit&”
       response.Write ”  ” 
       for i=1 to num
              response.Write ” ”
              response.Write ” ”
              response.Write ” ”
              response.Write ” ”
              response.Write ” ”
              response.Write ” “&stat_array(i,2)&”:”&stat_array(i,1)&unit&””
              response.Write ”  ” 
       next
       response.Write “”
       k1=180
       k4=10
       for i=1 to num
response.write “
              k2=360*pie(i)/2
              k3=k1+k2
              if k3>=360 then
                     k3=k3-360
              end if
              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*sin(k5)*0.7
              txt_y = table_top+all_height/14-39+R+R*cos(k5)*0.7*0.5
              titlestr = “名称:”&stat_array(i,2)&” 数值:”&stat_array(i,1)&unit&” 所占比例:”&pie(i)*100&”%”
              response.Write ” ”
              response.Write ” <v:shape id='cake"&i&"' type='#Cake_3D' title='"&titlestr&"'"
              response.Write ” 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&”‘”
              response.Write ” adj='”&kkk&”,0′ fillcolor='”&bg_color(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&”);’>”
              response.Write ” ”
              response.Write ” ”
              response.Write ” ”
              response.Write ” <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'"
              response.Write ” onmouseover=’ontxt(cake”&i&”,”&(table_top+all_height/14)&”,txt”&i&”,rec”&i&”)’>”
              response.Write ” ”
              response.Write ” ”
              response.Write ” ”
              response.Write ” ” 
              response.Write ” ”
              k1=k1+k2*2
              if k1>=360 then
                     k1=k1-360
              end if
              if k1>180 then
                     k4=k4+1
              else
                     k4=k4-1
              end if
response.write “

       next
end function
%>




v\:* { Behavior: url(#default#VML) }
o\:* { behavior: url(#default#VML) }




<!–
onit=true
num=0
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>27){
temptxt.style.display = “”;
}
if(at>(tempat-28)&&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){
temp = eval(iteam);
temptxt = eval(txt);
temprec = eval(rec)
if (onit){
temp.style.top = top-28;
temptxt.style.display = “”;
temprec.style.display = “”;
}
}
function movereset(over){
if (over==1){
onit=false
}else{
onit=true
}
}
–>

<%
dim total(10,2)
total(1,1)=2000
total(2,1)=1800
total(3,1)=1700
total(4,1)=1500
total(5,1)=1222
total(6,1)=1100
total(7,1)=1000
total(8,1)=800
total(9,1)=700
total(10,1)=600
total(1,2)=”项目1″
total(2,2)=”项目2″
total(3,2)=”项目3″
total(4,2)=”项目4″
total(5,2)=”项目5″
total(6,2)=”项目6″
total(7,2)=”项目7″
total(8,2)=”项目8″
total(9,2)=”项目9″
total(10,2)=”项目10″
call table2(total,120,20,900,500,”三维饼状图”,”元”)
‘参数含义(数组,横坐标,纵坐标,图表的宽度,图表的高度,图表标题,单位)
%>