ASP Generation Statistics Chart

Source: Internet
Author: User
Tags chr cos sin

<%
Dim Total (7,1)
Total (1,0) = "China Business Report"
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

% ><!--[If!mso]>
<style>
V\:* {behavior:url (#default #vml)}
O\:* {behavior:url (#default #vml)}
. Shape {Behavior:url (#default #vml)}
</style>
<! [endif]-->
<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 One
<%call Table3 (total,100,40,250,250, "A")%>
<Br><Br><Br><Br><Br><Br><Br><Br><Br><Br><Br> <Br><Br><Br><Br><Br><Br><Br><Br><Br> Example Two
<%call Table3 (total,300,450,250,250, "B")%>
</body>

<%
function Table3 (total,table_x,table_y,all_width,all_height,table_type)
' parameter meaning (passed array, horizontal axis, ordinate, chart width, chart height, chart type)
' Pure ASP code generation chart function 3--pie chart
' Author: 龚鸣 (PASSWORDGM) qq:25968152 msn:passwordgm@sina.com email:passwordgm@sina.com
I am very willing to communicate and discuss with Asp,vml,flash enthusiasts in HTTP://www.ilisten.cn.
' Thank you very much for using this function, please keep the copyright information when you use and reprint, which is the best respect for the author's work.
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) = "#33cccc"
Tb_color (5,2) = "#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= ' _x0000_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= ' 1500,1400 ' o:spt= ' adj= ' 0,,0 ' path= ' m750,700ae750,700,750,700, &int (23592960*preangle) & "," &int ( 23592960*total (i,1)/totalpie) & "Xe ' fillcolor= '" &tb_color (i,1) & "' strokecolor= ' #FFFFFF ' ><v:fill Color2= ' "&tb_color (i,2) &" ' rotate= ' t ' focus= ' 100% ' 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= ' _x0000_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= ' 100% ' height= ' 100% ' ><tr><td align= ' left ' > ' &total (i,0) & "</td></tr></table> </v:textbox></v:shape> "
Response.Write "<v:rect id= ' _x0000_s1040 ' alt= ' style= ':" &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= ' 100% '" type= "gradient"/></v: Rect> "
' Show proportional number
' 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= ' 100% ' height= ' 100% ' ><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&GT;TABLE_X+ALL_WIDTH/2 Then
X3=x2+20
X4=x3
Else
X3=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= ' _x0000_s1025 ' alt= ' style= ' : 1 ' from= ' "&x1&" px, "&y1&" px ' to= ' "&x2&" px, "&y2&" px ' coordsize= ' 21600,21600 ' Strokecolor= ' #111111 ' strokeweight= ' 1px ' ></v:line> '
Response.Write "<v:line id= ' _x0000_s1025 ' alt= ' style= ' : 1 ' from= ' "&x2&" px, "&y2&" px ' to= ' "&x3&" px, "&y2&" px ' coordsize= ' 21600,21600 ' Strokecolor= ' #111111 ' 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= ' 100% ' height= ' 100% ' ><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
% >

-->
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.