Pure ASP Code generation chart function-histogram

Source: Internet
Author: User
Tags xmlns

<%
function table1 (total,table_x,table_y,thickness,table_width,all_width,all_height,table_type)
' parameter meaning (passed array, horizontal axis, ordinate, column thickness, column width, chart width, chart height, chart type)
' Pure ASP code generation chart function 1--bar chart
' Author: 龚鸣 (PASSWORDGM) qq:25968152 msn:passwordgm@sina.com email:passwordgm@sina.com
' Version 2.0 last modification date 2003-7-22
' 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.
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"

Line_color= "#69f"
Left_width=70
Length=thickness/2
Total_no=ubound (total,1)

Temp1=0
For I=1 to Total_no
If Temp1<total (i,1) then Temp1=total (i,1)
Next
Temp1=int (TEMP1)
If Temp1>9 Then
Temp2=mid (CStr (TEMP1), 2, 1)
If Temp2>4 Then
temp3= (int (temp1/(10^ len (TEMP1)-1)) +1) *10^ (Len (CStr (TEMP1))-1)
Else
temp3= (int (temp1/(10^ len (TEMP1)-1)) +0.5) *10^ (Len (CStr (TEMP1))-1)
End If
Else
If Temp1>4 then temp3=10 else temp3=5
End If
Temp4=temp3
Response.Write "<!--[GTE VML 1]><v:rect id= ' _x0000_s1027 ' alt= ' style= ' position:absolute;left ':" & table_x+left_width& "Px;top:" &table_y& "Px;width:" &all_width& "Px;height:" &all_height & "Px;z-index:-1 ' fillcolor= ' #9cf ' stroked= ' F ' ><v:fill rotate= ' t ' angle= ' -45 ' focus= ' 100% ' type= ' gradient '" ></v:rect><! [endif]--> "
Response.Write "<!--[if GTE VML 1]><v:line id= ' _x0000_s1027 ' alt= style= ' position:absolute;left:0 '; Text-align:left;top:0;flip:y;z-index:-1 ' from= ' "&table_x+left_width&" px, "&table_y+all_height&" px ' to= ' "&table_x+all_width+left_width&" px, "&table_y+all_height&" px '/><! [endif]--> "
Response.Write "<!--[if GTE VML 1]><v:line id= ' _x0000_s1027 ' alt= style= ' position:absolute;left:0 '; Text-align:left;top:0;flip:y;z-index:-1 ' from= ' "&table_x+left_width&" px, "&table_y&" px ' to= ' &table_x+left_width& "px," &table_y+all_height& "px"/><! [endif]--> "

Select Case Table_type
Case "A"
Table_space= (all_width-table_width*total_no)/total_no
Response.Write "<!--[if GTE VML 1]><v:line id= ' _x0000_s1027 ' alt= style= ' position:absolute;left:0 '; Text-align:left;top:0;flip:y;z-index:-1 ' from= ' &table_x+left_width+length& px, ' &table_y& ' px ' to = ' "&table_x+left_width+length&" px, "&table_y+all_height-length&" px ' strokecolor= ' "&line_ color& "'/><! [endif]--> "
For i=0 to All_height-1 step ALL_HEIGHT/5
Response.Write "<!--[if GTE VML 1]><v:line id= ' _x0000_s1027 ' alt= style= ' position:absolute;left:0 '; Text-align:left;top:0;flip:y;z-index:-1 ' from= ' "&table_x+left_width&" px, "&table_y+all_ height-length-i& "px ' to= '" &table_x+left_width+length& "px," &table_y+all_height-i& "px" Strokecolor= ' "&line_color&" '/><! [endif]--> "
Response.Write "<!--[if GTE VML 1]><v:line id= ' _x0000_s1027 ' alt= style= ' position:absolute;left:0 '; Text-align:left;top:0;flip:y;z-index:-1 ' from= ' "&table_x+left_width+length&" px, "&table_y+all_ height-length-i& "px ' to= '" &table_x+all_width+left_width& "px," &table_y+all_height-length-i& " px ' strokecolor= ' "&line_color&" '/><! [endif]--> "
Response.Write "<!--[if GTE VML 1]><v:line id= ' _x0000_s1027 ' alt= style= ' position:absolute;left:0 '; Text-align:left;top:0;flip:y;z-index:-1 ' from= ' "&table_x+ (left_width-15) &" px, "&table_y+i&" px "to = ' &table_x+left_width& ' px, ' &table_y+i& ' px '/><! [endif]--> "
Response.Write "<!--[if GTE VML 1]>"
Response.Write "<v:shape id= ' _x0000_s1025 ' type= ' #_x0000_t202 ' alt= ' style= ' position:absolute;left:" &table_ x& "Px;top:" &table_y+i& "Px;width:" &left_width& "Px;height:18px;z-index:1 ' >"
Response.Write "<v:textbox inset= ' 0px,0px,0px,0px ' ><table cellspacing= ' 3 ' cellpadding= ' 0 ' width= ' 100% ' height= ' 100% ' ><tr><td align= ' right ' > ' &temp4& ' </td></tr></table></v: textbox></v:shape><! [endif]--> "
Temp4=temp4-temp3/5
Next
For I=1 to Total_no
temp_space=table_x+left_width+table_space/2+table_space* (i-1) +table_width* (i-1)
Response.Write "<v:rect id= ' _x0000_s1025 ' alt= ' style= ':"
Response.Write Temp_space
Response.Write "Px;top:"
Response.Write table_y+all_height* (Total (i,1)/temp3)
Response.Write "Px;width:" &table_width& "Px;height:" &all_height* (Total (i,1)/temp3) & "Px;z-index : 1 ' fillcolor= ' "&tb_color (i,2) &" ' > "
Response.Write "<v:fill color2= '" &tb_color (i,1) & "' rotate= ' t ' type= ' gradient '/> '"
Response.Write "<o:extrusion v:ext= ' view ' backdepth= '" &thickness& "pt ' color= '" &tb_color (i,2) & "' on= ' t '/> '
Response.Write "</v:rect>"
Response.Write "<v:shape id= ' _x0000_s1025 ' type= ' #_x0000_t202 ' alt= ' style= ' position:absolute;left:" &temp_ space& "Px;top:" &table_y+all_height* (Total (i,1)/temp3)-table_width& "Px;width:" &table_space+ 15& "Px;height:18px;z-index:1 ' >"
Response.Write "<v:textbox inset= ' 0px,0px,0px,0px ' ><table cellspacing= ' 3 ' cellpadding= ' 0 ' width= ' 100% ' height= ' 100% ' ><tr><td align= ' center ' > ' &total (i,1) & "</td></tr></table> </v:textbox></v:shape> "

Response.Write "<v:shape id= ' _x0000_s1025 ' type= ' #_x0000_t202 ' alt= ' style= ' position:absolute;left:" &temp_ space-table_space/2& "Px;top:" &table_y+all_height+1& "Px;width:" &table_space+table_width& "px ; Height:18px;z-index:1 ' > '
Response.Write "<v:textbox inset= ' 0px,0px,0px,0px ' ><table cellspacing= ' 3 ' cellpadding= ' 0 ' width= ' 100% ' height= ' 100% ' ><tr><td align= ' center ' > ' &total (i,2) & "</td></tr></table> </v:textbox></v:shape> "
Next
Case "B"
Table_space= (all_height-table_width*total_no)/total_no
Response.Write "<!--[if GTE VML 1]><v:line id= ' _x0000_s1027 ' alt= style= ' position:absolute;left:0 '; Text-align:left;top:0;flip:y;z-index:-1 ' from= ' "&table_x+left_width+length&" px, "&table_y+all_ height-length& "px ' to= '" &table_x+left_width+all_width& "px," &table_y+all_height-length& "px" Strokecolor= ' "&line_color&" '/><! [endif]--> "
For i=0 to All_width-1 step ALL_WIDTH/5
Response.Write "<!--[if GTE VML 1]><v:line id= ' _x0000_s1027 ' alt= style= ' position:absolute;left:0 '; Text-align:left;top:0;flip:y;z-index:-1 ' from= ' "&table_x+left_width+i&" px, "&table_y+all_ height-length& "px ' to= '" &table_x+left_width+length+i& "px," &table_y+all_height& "px" Strokecolor= ' "&line_color&" '/><! [endif]--> "
Response.Write "<!--[if GTE VML 1]><v:line id= ' _x0000_s1027 ' alt= style= ' position:absolute;left:0 '; Text-align:left;top:0;flip:y;z-index:-1 ' from= ' "&table_x+left_width+length+i&" px, "&table_y+all_ height-length& "px ' to= '" &table_x+left_width+length+i& "px," &table_y& "px ' strokecolor= '" & line_color& "'/><! [endif]--> "
Response.Write "<!--[if GTE VML 1]><v:line id= ' _x0000_s1027 ' alt= style= ' position:absolute;left:0 '; Text-align:left;top:0;flip:y;z-index:-1 ' from= ' "&table_x+left_width+i+all_width/5&" px, "&table_y+all _height& "px ' to= '" &table_x+left_width+i+all_width/5& "px," &table_y+all_height+15& "px"/> <! [endif]--> "
Response.Write "<!--[if GTE VML 1]>"
Response.Write "<v:shape id= ' _x0000_s1025 ' type= ' #_x0000_t202 ' alt= ' style= ' position:absolute;left:" &table_ x+left_width+i+all_width/5-left_width& "Px;top:" &table_y+all_height& "Px;width:" &left_width& "Px;height:18px;z-index:1 ' >"
Response.Write "<v:textbox inset= ' 0px,0px,0px,0px ' ><table cellspacing= ' 3 ' cellpadding= ' 0 ' width= ' 100% ' height= ' 100% ' ><tr><td align= ' right ' > ' &temp4& ' </td></tr></table></v: textbox></v:shape><! [endif]--> "
Temp4=temp4-temp3/5
Next

For I=1 to Total_no
temp_space=table_space/2+table_space* (i-1) +table_width* (i-1)
Response.Write "<v:rect id= ' _x0000_s1025 ' alt= ' style= ':"
Response.Write Table_x+left_width
Response.Write "Px;top:"
Response.Write Table_y+temp_space
Response.Write "Px;width:" &all_width* (Total (i,1)/temp3) & "Px;height:" &table_width& "Px;z-index:1" Fillcolor= ' "&tb_color (i,2) &" ' > "
Response.Write "<v:fill color2= '" &tb_color (i,1) & "rotate= ' t ' angle= ' -90 ' focus= ' 100% ' type= ' gradient '" > "
Response.Write "<o:extrusion v:ext= ' view ' backdepth= '" &thickness& "pt ' color= '" &tb_color (i,2) & "' on= ' t '/> '
Response.Write "</v:rect>"
Response.Write "<v:shape id= ' _x0000_s1025 ' type= ' #_x0000_t202 ' alt= ' style= ' position:absolute;left:" &table_ x+left_width+all_width* (Total (i,1)/temp3) +thickness/2& "px;top:" &table_y+temp_space& "Px;width:" &table_space+15& "Px;height:18px;z-index:1 ' >"
Response.Write "<v:textbox inset= ' 0px,0px,0px,0px ' ><table cellspacing= ' 3 ' cellpadding= ' 0 ' width= ' 100% ' height= ' 100% ' ><tr><td align= ' center ' > ' &total (i,1) & "</td></tr></table> </v:textbox></v:shape> "

Response.Write "<v:shape id= ' _x0000_s1025 ' type= ' #_x0000_t202 ' alt= ' style= ' position:absolute;left:" &table_ x& "Px;top:" &table_y+temp_space& "Px;width:" &left_width& "Px;height:18px;z-index:1 ' >"
Response.Write "<v:textbox inset= ' 0px,0px,0px,0px ' ><table cellspacing= ' 3 ' cellpadding= ' 0 ' width= ' 100% ' height= ' 100% ' ><tr><td align= ' right ' > ' &total (i,2) & "</td></tr></table> </v:textbox></v:shape> "
Next
Case Else
End Select

End Function
%>
<%
Dim Total (7,2)
Total (1,1) =200
Total (2,1) =800
Total (3,1) =1000
Total (4,1) =600
Total (5,1) =1222
Total (6,1) =3213
Total (7,1) =8

Total (1,2) = "China Business Report"
Total (2,2) = "Recruitment network"
Total (3,2) = "51Job"
Total (4,2) = "Xinmin Evening News"
Total (5,2) = "Evening News"
Total (6,2) = "Southern Weekend"
Total (7,2) = "Yangcheng Evening News"

Total_no=7
%>
<!--[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>
<%call table1 (total,200,20,20,30,400,200, "A")%>
<%call Table1 (total,200,320,20,20,400,250, "B")%>
</body>

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.