?? private_fun.asp
字號(hào):
<%
'參數(shù)含義(傳遞的數(shù)組,數(shù)組中行數(shù),柱圖橫坐標(biāo)位置,柱圖縱坐標(biāo)位置,柱子的厚度,柱子的寬度,圖表的寬度,圖表的高度)
function table1(total,total_no,table_x,table_y,thickness,table_width,all_width,all_height)
dim tb_color(100,2)
'柱狀圖顏色搭配
for i=1 to ubound(total,1) step 2
tb_color(i,1)="#d1ffd1"
tb_color(i+1,1)="#ffbbbb"
tb_color(i,2)="#00ff00"
tb_color(i+1,2)="#ff0000"
next
''整體圖形距左邊界的位置
left_width=70
'網(wǎng)格線設(shè)置
line_color="#69f"
length=thickness/2
'獲取數(shù)值中最大的一個(gè)值
temp1=0
for i=1 to total_no
if temp1<total(i,1) then temp1=total(i,1)
next
temp1=int(temp1)
'化整Y坐標(biāo)的刻度
if temp1>9 then
temp2=mid(cstr(temp1),2,1)
if temp2>4 then
temp3=(int(temp1/(10^(len(cstr(temp1))-1)))+1)*10^(len(cstr(temp1))-1)
else
temp3=(int(temp1/(10^(len(cstr(temp1))-1)))+0.5)*10^(len(cstr(temp1))-1)
end if
else
if temp1>4 then
temp3=10
else
temp3=5
end if
end if
temp4=temp3
''顯示背景色,并且設(shè)置未按照45度方向背景深度梯度顯示
response.write "<!--[if 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]-->"
''顯示X軸
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]-->"
''顯示Y軸
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]-->"
''按照設(shè)置的線寬,顯示出有寬度的Y軸
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]-->"
''計(jì)算兩個(gè)柱狀之間的空間寬度
table_space=(all_width-table_width*total_no)/total_no
''循環(huán)顯示網(wǎng)格線及其刻度
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
'從左到右依次顯示每一個(gè)柱圖及其注釋
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='position:absolute;left:"
response.write temp_space
response.write "px;top:"
response.write table_y+all_height*(1-(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+table_width+10&"px;top:"&table_y+all_height*(1-(total(i,1)/temp3))-table_width&"px;width:"&table_space+10&"px;height:18px;z-index:1'>"
response.write "<v:textbox inset='0px,0px,0px,0px'><table cellspacing='0' cellpadding='0' width='100%' height='100%'><tr><td align='left'>"&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+5&"px;width:"&table_space+table_width&"px;height:45px;z-index:1'>"
response.write "<v:textbox inset='0px,0px,0px,0px'><table cellspacing='0' cellpadding='0' width='100%' height='100%'><tr><td align='center' valign='top'>"&total(i,2)&"</td></tr></table></v:textbox></v:shape>"
next
end function
''按照地區(qū)顯示該地區(qū)所有用戶的交易金額
Function showareaclientmoney(str)
dim rec,area,kind
' 取得要匯總的地區(qū)類型
kind=right(trim(str),1)
' 取得要匯總的地區(qū)值
area=left(trim(str),len(trim(str))-1)
set rec = server.createobject("adodb.recordset")
' 根據(jù)地區(qū)類型分別選擇不同的查詢語(yǔ)句
select case kind
case 0
sql_show="SELECT SUM(Sellmoney) AS totalmoeny FROM Sell WHERE (SellClientID IN (SELECT clientid FROM client WHERE clientNation = '"&area&"')) "
case 1
sql_show="SELECT SUM(Sellmoney) AS totalmoeny FROM Sell WHERE (SellClientID IN (SELECT clientid FROM client WHERE clientProvince = '"&area&"')) "
case 2
sql_show="SELECT SUM(Sellmoney) AS totalmoeny FROM Sell WHERE (SellClientID IN (SELECT clientid FROM client WHERE clientcity = '"&area&"')) "
end select
rec.open sql_show,conn,3
if not rec.eof then
showareaclientmoney=rec("totalmoeny")
else
showareaclientmoney=""
end if
set rec=nothing
End Function
%>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -