ASP to generate three-dimensional pie graph function _ Application technique

Source: Internet
Author: User
To facilitate the generation of three-dimensional pie graph function, I collected the ASP to generate three-dimensional pie chart function code, to facilitate the use of special circumstances
Copy Code code as follows:

<%
' parameter meaning (array, horizontal axis, ordinate, chart width, chart height, chart title, unit)
function Table2 (stat_array,table_left,table_top,all_width,all_height,table_title,unit)
Dim Bg_color (A), 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 (a) = "#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 "<v:shapetype id= ' cake_3d ' coordsize= ' 21600,21600 ' o:spt= ' the adj= ' 11796480,5400 ' the ' path= '" al10800,10800@0@0@2 @14,10800,10800,10800,10800@3@15xe ' ></v:shapetype> '
Response. Write "<v:shapetype id= ' 3dtxt ' coordsize= ' 21600,21600 ' o:spt= ' 136 ' adj= ' 10800 ', ' path= '," "m@7,l@8,m@5,21600l@6,21600e" > "
Response. Write "<v:path textpathok= ' t ' o:connecttype= ' custom ' o:connectlocs= ' @9,0;@10,10800;@11,21600;@12,10800 ' O: connectangles= ' 270,180,90,0 '/> '
Response. Write "<v:textpath on= ' t ' fitshape= ' t '/>"
Response. Write "<o:lock v:ext= ' edit ' text= ' t ' shapetype= '/>"
Response. Write "</v:shapetype>"
Response. Write "<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 ' > '
Response. Write "<v:shadow on= ' t ' type= ' single ' color= ' Silver ' offset= ' 4pt,4pt '"/> "
Response. Write "</v:rect>"
Response. Write "<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 ' > '
Response. Write "<v:rect style= ' position:relative;left:500;top:200;width:20000;height:800 ' filled= ' false ' stroked= ' false ' > "
Response. Write "<v:textbox inset= ' 0pt,0pt,0pt,0pt ' >"
Response. Write "<table width= ' 100% ' border= ' 0 ' align= ' center ' cellspacing= ' 0 ' >"
Response. Write "<tr>"
Response. Write "<td align= ' center ' valign= ' middle ' ><div style= ' font-size:15pt; Font-family: Bold; ' ><B> "&table_title&" </B></div></td> "
Response. Write "</tr>"
Response. Write "</table>"
Response. Write "</v:TextBox>"
Response. Write "</v:Rect>"
Response. Write "<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 ' > '
Response. Write "<v:fill rotate= ' t ' angle= ' -45 ' focus= ' 100% ' type= ' gradient '"/> "
Response. Write "</v:rect>"
Response. Write "<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 ' > '
Response. Write "<v:fill rotate= ' t ' angle= ' -175 ' focus= ' 100% ' type= ' gradient '"/> "
Response. Write "<v:shadow on= ' t ' type= ' single ' color= ' Silver ' offset= ' 3pt,3pt '"/> "
Response. Write "</v:rect>"
Response. Write "<v:rect style= ' position:relative;left:15500;top:1500;width:4000;height:700 ' fillcolor= ' #000000 ' stroked= ' F ' strokecolor= ' #000000 ' > '
Response. Write "<v:textbox inset= ' 8pt,4pt,3pt,3pt ' style= ' font-size:11pt; ' ><div align= ' left ' ><font color= ' #ffffff ' ><B> total: "&allvalues&unit&" </B>< /font></div></v:textbox> "
Response. Write "</v:Rect>"
For I=1 to Num
Response. Write "<v:rect id= ' rec" &i& "' style= ' position:relative;left:15400;top:" &i*9000/11+1450& "; width : 4300;height:800;display:none ' fillcolor= ' #efefef ' strokecolor= ' "&bg_color (i) &" ' > "
Response. Write "<v:fill opacity= '. 6 ' color2= ' Fill darken (118) ' o:opacity2= '. 6 ' rotate= ' t ' method= ' linear sigma ' focus= ' 100% ' t ype= ' gradient '/> '
Response. Write "</v:Rect>"
Response. Write "<v:rect style= ' position:relative;left:15500;top:" &i*9000/11+1500& "; width:600;height:700 ' Fillcolor= ' "&bg_color (i) &" ' stroked= ' F '/> "
Response. Write "<v:rect style= ' position:relative;left:16300;top:" &i*9000/11+1500& "; width:3400;height:700 ' Filled= ' F ' stroked= ' f ' > '
Response. Write "<v:textbox inset= ' 0pt,5pt,0pt,0pt ' style= ' font-size:9pt; ' ><div align= ' left ' > "&stat_array (i,2) &": "&stat_array (i,1) &unit&" </div></v: Textbox> "
Response. Write "</v:Rect>"
Next
Response. Write "</v:group>"
k1=180
k4=10
For I=1 to Num
Response.Write "<a href=aaa.asp>"
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 = "Name:" &stat_array (i,2) & "value: &stat_array (i,1) &unit&" proportion: "&pie (i) *100&"% "
Response. Write "<div style= ' Cursor:hand; ' > "
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:" &AMP;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 "<v:fill opacity= ' 60293f ' color2= ' Fill lighten" o:opacity2= ' 60293f ' rotate= ' t ' angle= ' -135 ' method= ' Linear Sigma ' focus= ' 100% ' type= ' gradient '/> '
Response. Write "<o:extrusion v:ext= ' view ' on= ' t ' backdepth= ' rotationangle= ' viewpoint= ' 0,0 ' viewpointorigin= ' ' 0,0 '" skewamt= ' 0 ' lightposition= ' -50000,-50000 ' lightposition2= ' 50000 '/> '
Response. Write "</v:shape>"
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 "<v:fill opacity= ' 60293f ' color2= ' Fill lighten" o:opacity2= ' 60293f ' rotate= ' t ' angle= ' -135 ' method= ' Linear Sigma ' focus= ' 100% ' type= ' gradient '/> '
Response. Write "<v:textpath style= ' font-family: ' XXFarEastFont-Arial '; V-text-kern:t ' trim= ' t ' fitpath= ' t ' string= '" &pie (i) *100& '% '/ > "
Response. Write "<o:extrusion v:ext= ' view ' backdepth= ' 8pt ' on= ' t ' lightposition= ' 0,0 ' lightposition2= ' 0,0 '" "/>"
Response. Write "</v:shape>"
Response. Write "</div>"
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 "</a>"
Next
End Function
%>
<title></title>
<STYLE>
V\:* {behavior:url (#default #vml)}
O\:* {behavior:url (#default #vml)}
</STYLE>
<body>
<script language= "JavaScript" >
<!--
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
}
}
-->
</script>
<%
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) = "Item 1"
Total (2,2) = "Item 2"
Total (3,2) = "Item 3"
Total (4,2) = "Item 4"
Total (5,2) = "Item 5"
Total (6,2) = "Item 6"
Total (7,2) = "Item 7"
Total (8,2) = "Item 8"
Total (9,2) = "Item 9"
Total (10,2) = "Item 10"
Call Table2 (total,120,20,900,500, "three-dimensional pie chart", "Yuan")
' parameter meaning (array, horizontal axis, ordinate, chart width, chart height, chart title, unit)
%>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.