<% Dim total (7,1)
Total (1, 0) = "enlightening forum"
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">
<! -- [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 table3 (total, 250,250, "A") %>
<Br> <br> <Br> Example 2
<% Call table3 (total, 300,450,250,250, "B") %>
</Body>
</Html>
<%
Function table3 (total, table_x, table_y, all_width, all_height, table_type)
'Parameter meaning (transmitted array, abscissa, ordinate, chart width, chart height, chart type)
'Asp-only code generation chart function 3 -- pie chart
'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
Dim tb_color (7,2)
Tb_color (1, 1) = "# d1ffd1"
Tb_color (2, 1) = "# ffbbbb"
Tb_color (3,1) = "# ffe3bb"
Tb_color (4,1) = "# cff4f3"
Tb_color (5, 1) = "# d9d9e5"
Tb_color (6, 1) = "# ffc7ab"
Tb_color (7,1) = "# ecffb7"
Tb_color (1, 2) = "#00ff00"
Tb_color (2, 2) = "# ff0000"
Tb_color (3, 2) = "# ff9900"
Tb_color (4, 2) = "#33 cccc"
Tb_color (666699) ="
Tb_color (6, 2) = "#993300"
Tb_color (7,2) = "#99cc00"
Total_no = ubound (total, 1)
Totalpie = 0
For I = 1 to total_no
Totalpie = totalpie + total (I, 1)
Next
PreAngle = 0
For I = 1 to total_no
Response. write "<v: shape id = '_ xforwar_s1025' alt ='' style = 'position: absolute; left: "& table_x &" px; top: "& table_y &" 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 * PreAngle )&", "& int (23592960 * 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'/> <v: formulas/> <v: path o: connecttype = 'segments '/> </v: shape> "& CHr (13)
PreAngle = PreAngle + total (I, 1)/totalpie
Next
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
Pie= 3.14159265358979
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: 100px; 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
%>