Functions of asp to generate a three-dimensional pie chart

Source: Internet
Author: User

In order to generate a three-dimensional pie chart function conveniently, I collected the code of the function for generating a three-dimensional pie chart under asp, so that you can easily use it in special circumstances. Copy codeThe Code is as follows: <%
'Parameter meaning (array, abscissa, 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 (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 "<v: shapetype id = 'cake _ 3D 'coordsize = '000000' o: spt = '95' adj = '000000' path = 'al10800, 10800 @ 0 @ 0 @ 2 @ 10800, @ 3 @ 15xe> </v: shapetype>"
Response. write "<v: shapetype id = '3dtxt 'coordsize = '000000' o: spt = '000000' adj = '000000' 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 = '1970, 90, 0'/>"
Response. Write "<v: textpath on = 't'fitshape = 'T'/>"
Response. Write "<o: lock v: ext = 'edit' text = 't'shapetype = 'T'/>"
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 = '000000'>"
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 = '000000' border = '0' align = 'center' cellspacing = '0'>"
Response. Write "<tr>"
Response. write "<td align = 'center' valign = 'middle'> <div style = 'font-size: 15pt; font-family:; '> <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 = '000000' 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 = '-000000' focus = '000000' 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 =' # ffff'> <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 = '000000' type = '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 * sin (k5) x 0.7
Txt_y = table_top + all_height/14-39 + 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:" & 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 (120) 'o: opacity2 = '60293f' rotate = 't'angle = '-135' method = 'linear sigma 'focus = '000000' type = 'gradient'/>"
Response. write "<o: extrusion v: ext = 'view' on = 't'background= '25' rotationangle = '60' viewpoint = '0, 0' viewpointorigin = '0, 0 'skewamt = '0' lightposition = '-50000,-50000 'lightposition2 = '20140901'/>"
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 = '# ffff '"
Response. write "onmouseover = 'ontxt (cake" & I & "," & (table_top + all_height/14) & ", txt" & I & ", rec" & I &") '>"
Response. write "<v: fill opacity = '60293f' color2 = 'fill lighten (120) 'o: opacity2 = '60293f' rotate = 't'angle = '-135' method = 'linear sigma 'focus = '000000' type = 'gradient'/>"
Response. write "<v: textpath style = 'font-family: ' '; 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
%>
<Html xmlns: v = "urn: schemas-microsoft-com: vml" xmlns: o = "urn: schemas-microsoft-com: office">
<Head>
<Title> </title>
<STYLE>
V \: * {Behavior: url (# default # VML )}
O \: * {behavior: url (# default # VML )}
</STYLE>
</Head>
<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) = "Project 1"
Total (2, 2) = "Project 2"
Total (3, 2) = "Project 3"
Total (4, 2) = "Project 4"
Total (5, 2) = "Project 5"
Total (6, 2) = "Project 6"
Total (7,2) = "Project 7"
Total (8, 2) = "Project 8"
Total (9, 2) = "Project 9"
Total (10, 2) = "Project 10"
Call table2 (total, 900,500, "3D pie chart", "RMB ")
'Parameter meaning (array, abscissa, 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.