Three-dimensional pie chart

Source: Internet
Author: User

<% Dim total (7,1)
Total (1, 0) = "China Business News"
Total (2, 0) = "recruitment network"
Total (3, 0) = "51job"
Total (4, 0) = "Xinmin Evening News"
Total (5, 0) = "Evening News"
Total (6, 0) = "Southern Weekend"
Total (7,0) = "Yangcheng Evening News"

Total (1, 1) = 200
Total (2, 1) = 1200
Total (3, 1) = 900
Total (4, 1) = 600
Total (5, 1) = 1222
Total (6, 1) = 413
Total (7,1) = 800

%> <HTML xmlns: V = "urn: Schemas-Microsoft-com: VML" xmlns: O = "urn: Schemas-Microsoft-com: Office: office">
<! -- [If! MSO]>
<Style>
V \: * {behavior: URL (# default # VML )}
O \: * {behavior: URL (# default # VML )}
. Shape {behavior: URL (# default # VML )}
</Style>
<! [Endif] -->
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
<Title> </title>
<Style>
TD {font-size: 9pt}
</Style> <Body topmargin = 5 leftmargin = 0 scroll = auto>
Example 1
<% Call table4 (total, 100,40, 250,250, 50,0, "A") %>
<Br> <BR> <br> Example 2
<% 'Call table3 (total, 300,450,250,250, "A") %>
</Body>
</Html>

<%
Function table4 (total, table_x, table_y, all_width, all_height, thickness, cut_no, table_type)
'Parameter meaning (transmitted array, abscissa, ordinate, chart width, chart height, pie chart thickness, separated block number, chart type)
'Asp-only code generation chart function 4 -- three-dimensional pie chart
'Author: passwordgm QQ: 25968152 MSN: passwordgm@sina.com Email: passwordgm@sina.com
'I am very willing to discuss with ASP, VML, and Flash fans at http: // www.ilisten.cn.
'Thank you very much for using this function. Please retain the copyright information when you use and repost it. This is the best respect for the work of the author.
Tb_height = 30
Pie= 3.14159265358979
Rotationangle1 = 55
Rotationangle2 =-30

Dim tb_color (7,2)
Tb_color (1, 1) = "# d1ffd1"
Tb_color (2, 1) = "# ffbbbb"
Tb_color (3,1) = "# ffe3bb"
Tb_color (4,1) = "# ff6600"
Tb_color (5, 1) = "# d9d9e5"
Tb_color (6, 1) = "# ffc7ab"
Tb_color (7,1) = "# FFFF00"

Tb_color (1, 2) = "#00ff00"
Tb_color (2, 2) = "# ff0000"
Tb_color (3, 2) = "# ff9900"
Tb_color (4, 2) = "# ffcc09"
Tb_color (666699) ="
Tb_color (6, 2) = "#993300"
Tb_color (7,2) = "# ffcc00"

Total_no = ubound (total, 1)
Totalpie = 0
For I = 1 to total_no
Totalpie = totalpie + total (I, 1)
Next
%> <V: Group ID = "_ x0000_s1032" style = 'position: absolute; left: 75pt; top: 67.5pt; width: 187.5pt; Height: 187.5pt; Z-index: 1 'coordorigin = "250,250" coordsize = ""> <%
Preangle = 0
Temppie = 0
Dim temp_total
Redim temp_total (total_no, 7)
Temp_total (1, 3) = 0
K = 1
Flag1 = 0
For I = 1 to total_no
Tempangle = pie * 2 * (total (I, 1)/(totalpie * 2) + temppie)
X1 = table_x + all_width/2 + cos (tempangle) * all_width/2
Y1 = table_y + all_height/2-sin (tempangle) * all_height/2

Tempangle2 = pie * 2 * (total (I, 1)/(totalpie * 2) + TempPie-0.046)
X2 = table_x + all_width/2 + cos (tempangle2) * all_width/2 + sin (tempangle2) * all_height/2 * sin (pie * (rotationangle1/180) * 0.1
Y2 = table_y + all_height/2-sin (tempangle2) * all_height/2 + sin (tempangle2) * all_height/2 * sin (pie * (rotationangle1/180) * 0.07

If temppie * pie * 2 <pie/2 and (temppie + total (I, 1)/totalpie) * pie * 2> = pie/2 then
Temp_total (1, 1) = total (I, 1)
Temp_total (1, 2) = Y1
Temp_total (1, 3) = temppie
Temp_total (1, 4) = I
Temp_total (1, 5) = x1
Temp_total (1, 6) = x2
Temp_total (1, 7) = Y2
Else
If temppie * pie * 2 <pie * 2*3/4 and (temppie + total (I, 1)/totalpie) * pie * 2> = pie * 2*3/4 then
Temp_total (total_no, 1) = total (I, 1)
Temp_total (total_no, 2) = Y1
Temp_total (total_no, 3) = temppie
Temp_total (total_no, 4) = I
Temp_total (total_no, 5) = x1
Temp_total (total_no, 6) = x2
Temp_total (total_no, 7) = Y2
Flag1 = 1
Else
K = k + 1
Temp_total (k, 1) = total (I, 1)
Temp_total (K, 2) = Y1
Temp_total (K, 3) = temppie
Temp_total (K, 4) = I
Temp_total (K, 5) = x1
Temp_total (K, 6) = x2
Temp_total (K, 7) = Y2
End if
End if
Temppie = temppie + total (I, 1)/totalpie
'If k <total_no then temp_total (k + 1, 3) = temppie
Next
For I = 1 to total_no
Response. write "Total" & I & "(" & temp_total (I, 1) & "," & formatnumber (temp_total (I, 3), 2,-1 )&", "& temp_total (I, 4) &") "&" <br>"
Next
'Response. End
If total_no> 3 then
If flag1 = 1 thenm = total_no-1 else M = total_no
Do
N = 0
For I = 3 to m
If temp_total (I-1, 2)> temp_total (I, 2) then
For j = 1 to 5
Temp_total (I-1, J)
Temp_total (I-1, j) = temp_total (I, j)
Temp_total (I, j) = temp
Next
N = I
End if
Next
M = N
Loop until (M <2)
End if

For I = 1 to total_no
If cut_no = temp_total (I, 4) then
X5 = table_x + (all_width/2)
'Response. Write "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" & X5
Y5 = (temp_total (I, 7)-table_y-all_height/2)/2
Else
X5 = table_x
Y5 = table_y
End if
If temp_total (I, 1)> = totalpie/2 then
Response. write "<v: Shape id = '_ xforwar_s1025' alt ='' style = 'position: absolute; left: "& X5 &" PX; top: "& Y5 &" PX; width: "& all_width &" PX; Height: "& all_height &" PX; Z-index: 1 'coordsize = '100 0' O: SPT = '000000' adj = '0, 0' Path = 'm750, 700ae750, 100, "& int (700,750,700 * temp_total (I, 3 ))&", "& int (23592960 * (1/2-temp_total (I, 3) &" Xe 'fillcolor = '"& tb_color (I, 2) & "'strokecolor = '# ffff'> <v: Fill color2 ='" & tb_color (I, 2) & "'rotate = 't'focus = '000000' type = 'gradient'/> <v: stroke joinstyle = 'round'/> <O: extrusion V: EXT = 'view' backdepth = '"& thickness &" PX' on = 't'rotationangle = '"& rotationangle1 &", "& rotationangle2 &"'/> <V: formulas/> <v: path O: connecttype = 'segments '/> </V: Shape> "& CHR (13)
If (temp_total (I, 3) + temp_total (I, 1)/totalpie)> 0.75 then z_index = "2" else z_index = "1"
Response. write "<v: Shape id = '_ xforwar_s1025' alt ='' style = 'position: absolute; left: "& X5 &" PX; top: "& Y5 &" PX; width: "& all_width &" PX; Height: "& all_height &" PX; Z-index: "& z_index &" 'coordsize = '000000' O: SPT = '000000' adj = '0, 0' Path = 'm750, 700ae750, 1500,140, "& int (23592960*1/2) &", "& int (23592960 * (temp_total (I, 1)/totalpie-1/2 + temp_total (I, 3 ))) & "Xe 'fillcolor = '" & tb_color (I, 2) & "'strokecolor =' # ffff'> <v: Fill color2 = '" & tb_color (I, 2) & "'rotate = 't'focus = '000000' type = 'gradient'/> <v: stroke joinstyle = 'round'/> <O: extrusion V: EXT = 'view' backdepth = '"& thickness &" PX' on = 't'rotationangle = '"& rotationangle1 &", "& rotationangle2 &"'/> <V: formulas/> <v: path O: connecttype = 'segments '/> </V: Shape> "& CHR (13)
Else
Response. write "<v: Shape id = '_ xforwar_s1025' alt ='' style = 'position: absolute; left: "& X5 &" PX; top: "& Y5 &" PX; width: "& all_width &" PX; Height: "& all_height &" PX; Z-index: 1 'coordsize = '100 0' O: SPT = '000000' adj = '0, 0' Path = 'm750, 700ae750, 100, "& int (700,750,700 * temp_total (I, 3 ))&", "& int (23592960 * temp_total (I, 1)/totalpie) &" Xe 'fillcolor = '"& tb_color (I, 1) & "'strokecolor = '# ffff'> <v: Fill color2 ='" & tb_color (I, 2) & "'rotate = 't'focus = '000000' type = 'gradient'/> <v: stroke joinstyle = 'round'/> <O: extrusion V: EXT = 'view' backdepth = '"& thickness &" PX' on = 't'rotationangle = '"& rotationangle1 &", "& rotationangle2 &"'/> <V: formulas/> <v: path O: connecttype = 'segments '/> </V: Shape> "& CHR (13)
End if
'Preangle = preangle + total (I, 1)/totalpie
'Response. write "<v: rect id =" "_ x1__s1027" "style = 'position: absolute; left:" & temp_total (I, 6) & "PX; top: "& temp_total (I, 7) &" PX; width: 4px; Height: 4px; Z-index: 2 'fillcolor = "" #111111 "" strokecolor = "" #111111 ""/> "& CHR (13)
Next
%> </V: group> <%
'If table_type = "A" then
'Response. write "<v: rect id = '_ xforwar_s1025' style = 'position: absolute; left:" & table_x + all_width + 20 & "PX; top: "& table_y + 20 &" PX; width: 100px; Height: "& total_no * tb_height + 20 &" PX; Z-index: 1'/>"
'For I = 1 to total_no
'Response. write "<v: Shape id = '_ x0000_s1025' type = '# _ x0000_t202' alt ='' style = 'position: absolute; left: "& table_x + all_width + 25 &" PX; top: "& table_y + 30 + (I-1) * tb_height &" PX; width: 60px; height: "& tb_height &" PX; Z-index: 1'>"
'Response. write "<v: textbox inset = '0px, 0px, 0px, 0px '> <Table cellspacing = '3' cellpadding = '0' width = '000000' Height = '000000'> <tr> <TD align = 'left'> "& total (I, 0) & "</TD> </tr> </table> </V: textbox> </V: Shape>"
'Response. write "<v: rect id = '_ xforwar_s1040' alt ='' style = 'position: absolute; left: "& table_x + all_width + 80 &" PX; top: "& table_y + 30 + (I-1) * tb_height + 3 &" PX; width: 30px; Height: 20px; Z-index: 1 'fillcolor = '"& tb_color (I, 1) & "'> <v: Fill color2 ='" & tb_color (I, 2) & "'rotate = 't'focus = '000000' type = 'gradient'/> </V: rect>"
'Display Ratio
'Response. write "<v: Shape id = '_ x0000_s1025' type = '# _ x0000_t202' alt ='' style = 'position: absolute; left: "& table_x + all_width + 110 &" PX; top: "& table_y + 30 + (I-1) * tb_height &" PX; width: 60px; height: "& tb_height &" PX; Z-index: 1'>"
'Response. write "<v: textbox inset = '0px, 0px, 0px, 0px '> <Table cellspacing = '3' cellpadding = '0' width = '000000' Height = '000000'> <tr> <TD align = 'left'> "& formatnumber (Total (I, 1) * 100/totalpie, 2,-1) & "% </TD> </tr> </table> </V: textbox> </V: Shape>"
'Next
'End if

If table_type = "B" then
Temppie = 0
For I = 1 to total_no
Tempangle = pie * 2 * (total (I, 1)/(totalpie * 2) + temppie)
X1 = table_x + all_width/2 + cos (tempangle) ** all_width * 3/8
Y1 = table_y + all_height/2-sin (tempangle) * all_height * 3/8
X2 = table_x + all_width/2 + cos (tempangle) * all_width * 3/4
Y2 = table_y + all_height/2-sin (tempangle) * all_height * 3/4
If X2> table_x + all_width/2 then
X3 = x2 + 20
X4 = X3
Else
3 = x2-20
X4 = x3-100
End if
Response. write "<v: oval id = '_ x0000_s1027' style = 'position: absolute; left:" & x1-2 & "PX; top:" & y1-2 & "PX; width: 4px; Height: 4px; Z-index: 2 'fillcolor = '#111111 'strokecolor =' #111111 '/> "& CHR (13)
Response. write "<v: Line id = '_ xforwar_s1025' alt ='' style = 'position: absolute; left: 0; text-align: Left; top: 0; z-index: 1 'from = '"& X1 &" PX, "& Y1 &" PX' To = '"& X2 &" PX, "& Y2 &" PX 'coordsize = '000000' strokecolor = '#21600,216 'strokeweight = '1px'> </V: Line>"
Response. write "<v: Line id = '_ xforwar_s1025' alt ='' style = 'position: absolute; left: 0; text-align: Left; top: 0; z-index: 1 'from = '"& X2 &" PX, "& Y2 &" PX' To = '"& X3 &" PX, "& Y2 &" PX 'coordsize = '000000' strokecolor = '#21600,216 'strokeweight = '1px'> </V: Line>"
Response. write "<v: Shape id = '_ x0000_s1025' type = '# _ x0000_t202' alt ='' style = 'position: absolute; left: "& X4 &" PX; top: "& y2-10 &" PX; width: 130px; Height: 20px; Z-index: 1'>"
Response. write "<v: textbox inset = '0px, 0px, 0px, 0px '> <Table cellspacing = '3' cellpadding = '0' width = '000000' Height = '000000'> <tr> <TD align = 'left'> "& total (I, 0) & "& formatnumber (total (I, 1) * 100/totalpie, 2,-1) & "% </TD> </tr> </table> </V: textbox> </V: Shape>"
Temppie = temppie + total (I, 1)/totalpie
Next
End if

End Function
%>
Article from: http://blog.javaresearch.org/page/myeclipse

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.