⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 graph.asp

📁 一个VB的p2p聊天系统
💻 ASP
字号:
<!--#include file="headfiles/Connection.inc"-->
<%		
'统计性别
set rstongji=server.CreateObject("ADODB.RECORDSET")
strSql="select * from tongji where Sex_name='男'"
	rstongji.open strSql,Conn,3,1
    while not rstongji.BOF and not rstongji.EOF 
      man=man+1 
      rstongji.MoveNext()
	wend

set rstongji=server.CreateObject("ADODB.RECORDSET")	
    strSql="select * from tongji where Sex_name='女'"
	rstongji.open strSql,Conn,3,1
    while not rstongji.BOF and not rstongji.EOF 
      woman=woman+1 
     rstongji.MoveNext()
wend

'统计政治面貌
set rstongji=server.CreateObject("ADODB.RECORDSET")
strSql="select * from tongji where Political_Name='党员'"
	rstongji.open strSql,Conn,3,1
    while not rstongji.BOF and not rstongji.EOF 
      dangy=dangy+1 
      rstongji.MoveNext()
	wend

set rstongji=server.CreateObject("ADODB.RECORDSET")	
    strSql="select * from tongji where Political_Name='团员'"
	rstongji.open strSql,Conn,3,1
    while not rstongji.BOF and not rstongji.EOF 
      tuany=tuany+1 
      rstongji.MoveNext()
	wend
	
set rstongji=server.CreateObject("ADODB.RECORDSET")	
    strSql="select * from tongji where Political_Name='群众'"
	rstongji.open strSql,Conn,3,1
    while not rstongji.BOF and not rstongji.EOF 
      qunz=qunz+1 
      rstongji.MoveNext()
	wend
'统计民族
set rstongji=server.CreateObject("ADODB.RECORDSET")	
    strSql="select * from tongji where Nation_Name='汉族'"
	rstongji.open strSql,Conn,3,1
    while not rstongji.BOF and not rstongji.EOF 
      hz=hz+1 
      rstongji.MoveNext()
	wend
	
set rstongji=server.CreateObject("ADODB.RECORDSET")	
    strSql="select * from tongji where Nation_Name='满族'"
	rstongji.open strSql,Conn,3,1
    while not rstongji.BOF and not rstongji.EOF 
      mz=mz+1 
      rstongji.MoveNext()
	wend


set rstongji=server.CreateObject("ADODB.RECORDSET")	
    strSql="select * from tongji where Nation_Name='蒙古族'"
	rstongji.open strSql,Conn,3,1
    while not rstongji.BOF and not rstongji.EOF 
      mgz=mgz+1 
      rstongji.MoveNext()
	wend	
	
'统计婚姻情况
set rstongji=server.CreateObject("ADODB.RECORDSET")	
    strSql="select * from tongji where Married_Name='未婚'"
	rstongji.open strSql,Conn,3,1
    while not rstongji.BOF and not rstongji.EOF 
      wh=wh+1 
      rstongji.MoveNext()
	wend	
	
set rstongji=server.CreateObject("ADODB.RECORDSET")	
    strSql="select * from tongji where Married_Name='离异'"
	rstongji.open strSql,Conn,3,1
    while not rstongji.BOF and not rstongji.EOF 
      ly=ly+1 
      rstongji.MoveNext()
	wend		

set rstongji=server.CreateObject("ADODB.RECORDSET")	
    strSql="select * from tongji where Married_Name='已婚'"
	rstongji.open strSql,Conn,3,1
    while not rstongji.BOF and not rstongji.EOF 
      yh=yh+1 
      rstongji.MoveNext()
	wend	

set rstongji=server.CreateObject("ADODB.RECORDSET")	
    strSql="select * from tongji where Married_Name='再婚'"
	rstongji.open strSql,Conn,3,1
    while not rstongji.BOF and not rstongji.EOF 
      zh=zh+1 
      rstongji.MoveNext()
	wend	

'部门人员统计
set rstongji=server.CreateObject("ADODB.RECORDSET")	
    strSql="select * from tongji1 where Depart_Name='行政部'"
	rstongji.open strSql,Conn,3,1
    while not rstongji.BOF and not rstongji.EOF 
      xzb=xzb+1 
      rstongji.MoveNext()
	wend	

set rstongji=server.CreateObject("ADODB.RECORDSET")	
    strSql="select * from tongji1 where Depart_Name='财务部'"
	rstongji.open strSql,Conn,3,1
    while not rstongji.BOF and not rstongji.EOF 
      cwb=cwb+1 
      rstongji.MoveNext()
	wend	

set rstongji=server.CreateObject("ADODB.RECORDSET")	
    strSql="select * from tongji1 where Depart_Name='软件开发部'"
	rstongji.open strSql,Conn,3,1
    while not rstongji.BOF and not rstongji.EOF 
      rjkfb=rjkfb+1 
      rstongji.MoveNext()
	wend	

set rstongji=server.CreateObject("ADODB.RECORDSET")	
    strSql="select * from tongji1 where Depart_Name='市场部'"
	rstongji.open strSql,Conn,3,1
    while not rstongji.BOF and not rstongji.EOF 
      scb=scb+1 
      rstongji.MoveNext()
	wend
	
set rstongji=server.CreateObject("ADODB.RECORDSET")	
    strSql="select * from tongji1 where Depart_Name='客户服务部'"
	rstongji.open strSql,Conn,3,1
    while not rstongji.BOF and not rstongji.EOF 
      khfwb=khfwb+1 
      rstongji.MoveNext()
	wend			

'人员学历统计
set rstongji=server.CreateObject("ADODB.RECORDSET")	
    strSql="select * from tongji1 where EduDegree_Name='博士'"
	rstongji.open strSql,Conn,3,1
    while not rstongji.BOF and not rstongji.EOF 
      bs=bs+1 
      rstongji.MoveNext()
	wend			

set rstongji=server.CreateObject("ADODB.RECORDSET")	
    strSql="select * from tongji1 where EduDegree_Name='大学本科'"
	rstongji.open strSql,Conn,3,1
    while not rstongji.BOF and not rstongji.EOF 
      dxbk=dxbk+1 
      rstongji.MoveNext()
	wend			

set rstongji=server.CreateObject("ADODB.RECORDSET")	
    strSql="select * from tongji1 where EduDegree_Name='硕士'"
	rstongji.open strSql,Conn,3,1
    while not rstongji.BOF and not rstongji.EOF 
      ss=ss+1 
      rstongji.MoveNext()
	wend
	
set rstongji=server.CreateObject("ADODB.RECORDSET")	
    strSql="select * from tongji1 where EduDegree_Name='专科'"
	rstongji.open strSql,Conn,3,1
    while not rstongji.BOF and not rstongji.EOF 
      zk=zk+1 
      rstongji.MoveNext()
	wend							
%>


<html>
<!--<SCRIPT language=JavaScript>
function view1(){
	aMonthValues = array(man,woman)  
    aMonthNames = array("男","女")  
    displayverticalgraph "统计图表",aMonthValues,aMonthNames 
}

function view2(){
aMonthValues = array(dangy,tuany,qunz)  
aMonthNames = array("党员","团员","群众")  
displayverticalgraph "统计图表",aMonthValues,aMonthNames 
}
</SCRIPT>-->
<head>
	<title>统计</title>
    <script language="JavaScript" type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
    </script>
</head>
<body background="images/bg.gif">


<%
sub displayverticalgraph(strtitle,avalues,alabels)

'************************************************************************

const GRAPH_HEIGHT 	= 200 	 		'设置图表高度
const GRAPH_WIDTH 	= 400   		'设置图表宽度
const GRAPH_SPACING 	= 0	
const GRAPH_BORDER 	= 0	 		'图表边框线宽度	
const GRAPH_BARS 	= 10   		        '设置循环使用不同柱状图颜色的数量,排列顺序见下
const USELOWVALUE 	= FALSE 		
const SHOWLABELS 	= TRUE  		
const L_LABEL_SEPARATOR = "|"			' |标签
const R_LABEL_SEPARATOR = "|"			' 标签|
const LABELSIZE 	= 4			
const GRAPHBORDERSIZE 	= 1
const INTIMGBORDER 	= 1  	 		'线条周围的边框线宽度
Const ALT_TEXT		= 3			'改变线条图象的交替显示文字格式
						'1 = 标签 ,2 = 数值 , 3 = 标签 + 数值 , 4 = 百分比

'**********下行表示循环显示的柱状图颜色排列************************************
agraph_bars = array("blue","orange","red","light_blue","dark_green","pink","light_gold","gold","green","purple")


intmax = 0

'从数值排列中找出最大值
for i = 0 to ubound(avalues)
if  cint(intmax) < cint(avalues(i)) then  intmax = cint(avalues(i)) 
next
if uselowvalue then 
intmin = avalues(0)
for i = 0 to ubound(avalues)
if  cint(intmin) > cint(avalues(i)) then  intmin = cint(avalues(i)) 
next
end if
'establish the graph multiplier
graphmultiplier = round(graph_height-100/intmax)

imgwidth = round(300/(ubound(avalues)+1))
if imgwidth > 16 then imgwidth = 30 


%>

<table height=<%=graph_height%> border =1 align="center" width:100%>
<!--<%=GRAPH_BORDER%>-->
  
  <tr>
    <td rowspan=3 valign="middle"><%=strytitle%></td>
	<td colspan=<%=ubound(avalues)+2%> height=50 align="center">
	
      <h4><center><%=strtitle%></center></h4></td>
  </tr>
	<% count = 0%>
     <tr>
       <td>
	 <table border=<%=graph_border%> cellpadding = 0 cellspacing = <%=graph_spacing%>><tr>
	    <tr>
	     <TD height="100%">
	      <table border="<%=graph_border%>" height="100%">
	         <tr>
	         <td height="50%" valign="top" align=right><%=intmax%></td>
	         </tr>
	         <tr>
	         <td height="50%" valign="bottom" align=right>
		 
		 <%if uselowvalue then
	             response.write cstr(intmin)
		   else
		     response.write "0"
		   end if
		  %>
		 </td>
	         </tr>
	      </table>
	     </td>
	     <td valign="bottom" align="right"><img src="leftbord.gif" width="4" height="<%=graphmultiplier+8%>">
	     </td>
             
             <%
               for i = 0 to ubound(avalues)
	       strgraph = agraph_bars(count)
	       	if alt_text = 1 then 
		   stralt = alabels(i)
		  elseif alt_text = 2 then 
		    stralt = avalues(i)
		  elseif alt_text = 3 then 
		    stralt = alabels(i) &" - "  &avalues(i)
		  elseif alt_text = 4 then   
		    stralt = round(avalues(i) /intmax  *100,2) &"%"
		 end if     
	        
	        if uselowvalue then  %>
                  <td valign="bottom" align="center">
	          <img src="images\<%=strgraph%>.gif" height="<%=round((avalues(i)-intmin)/intmax*graphmultiplier,0)%>" width="<%=imgwidth%>" alt="<%=strAlt%>" border="<%=intimgborder%>"></td><td>&nbsp;</td>
	       <%else%>
	          <td valign="bottom" align="center">
	          <img src="images\<%=strgraph%>.gif" height="<%=round(avalues(i)/intmax*graphmultiplier,0)%>" width="<%=imgwidth %>" alt="<%=strAlt%>" border="<%=intimgborder%>"></td>
	       <%end if 
		
	        if count = graph_bars-1 then 
	          count = 0 
	        else
	          count = count + 1
	        end if		
	      next  
	      
	     response.write "<td width='50'>&nbsp;</td></tr><tr><td width=8>&nbsp;</td><td>&nbsp;</td><td colspan=" &(ubound(avalues)+1) &" valign='top'>" _
	      &"<img src='botbord.gif' width='100%' height='2'</td></tr>"
	     if showlabels then %>
        <tr><td width=8 height=1>&nbsp;</td><td>&nbsp;</td>
	            <%for i = 0 to ubound(avalues)%>
	               <td valign="bottom" width=<%=imgwidth%> ><font size=
	               <%=labelsize &">" &alabels(i)%></font></td>
	            <%next%>
        </tr>
	     <%end if%>
    	<tr><td colspan=<%=ubound(avalues)+3%> height=50 align="center"><%=strxtitle%></td>
    	</tr>
	</table>
	</td>
	</tr>
	<tr>
	<td></td></tr>
</table>

<p>
  <%end sub %>

<%
dim flag
flag=request("sm")

select case flag
      case 1
      aMonthValues = array(man,woman)  '括号内填入与X轴对应的数值
      aMonthNames = array("男","女")  '括号内填入与X轴的月份名称
       displayverticalgraph "性别统计图表",aMonthValues,aMonthNames  '分别是图表名称,X轴、Y轴名称
      case 2
      aMonthValues = array(dangy,tuany,qunz)  '括号内填入与X轴对应的数值
      aMonthNames = array("党员","团员","群众")  '括号内填入与X轴的月份名称
      displayverticalgraph "政治面貌统计图表",aMonthValues,aMonthNames
	  case 3
	  aMonthValues = array(hz,mz,mgz)  '括号内填入与X轴对应的数值
      aMonthNames = array("汉族","满族","蒙古族")  '括号内填入与X轴的月份名称
      displayverticalgraph "民族统计图表",aMonthValues,aMonthNames
	  case 4
	  aMonthValues = array(wh,yh,ly,zh)  '括号内填入与X轴对应的数值
      aMonthNames = array("未婚","已婚","离异","再婚")  '括号内填入与X轴的月份名称
      displayverticalgraph "婚姻状况统计图表",aMonthValues,aMonthNames
	  case 5
	  aMonthValues = array(xzb,cwb,rjkfb,scb,khfwb)  '括号内填入与X轴对应的数值
      aMonthNames = array("行政部","财务部","软件开发部","市场部","客户服务部")  '括号内填入与X轴的月份名称
      displayverticalgraph "部门人员状况统计图表",aMonthValues,aMonthNames
	  case 6
	  aMonthValues = array(bs,ss,dxbk,zk)  '括号内填入与X轴对应的数值
      aMonthNames = array("博士","硕士","本科","专科")  '括号内填入与X轴的月份名称
      displayverticalgraph "学历状况统计图表",aMonthValues,aMonthNames
end select 
%>
<table width="98%" height="30" border="1" align="center" cellpadding="0" cellspacing="0" bordercolorlight="#666666" bordercolordark="#FFFFFF">
              <tr>
                <td>
                  <div align="center"><a href="graph.asp?sm=1">性别</a></div></td>
                <td>
                  <div align="center"><a href="graph.asp?sm=2">政治面貌</a></div></td>
				  <td>
                  <div align="center"><a href="graph.asp?sm=3">民族</a></div></td>
				  <td>
                  <div align="center"><a href="graph.asp?sm=4">婚姻状况</a></div></td>
				  <td>
                  <div align="center"><a href="graph.asp?sm=5">部门人员</a></div></td>
				  <td>
                  <div align="center"><a href="graph.asp?sm=6">学历</a></div></td>
			  </tr>
			  </table>
<!--<form name="form1" method="post" action="graph.asp">
  <select name="select">
    <option>性别</option>
    <option>政治面貌</option>
  </select>
  <input type="submit" name="Submit" value="确定">
</form>--> 
  <!--<script>
  var tc_user="jgwy";
</script> <script src="http://stat.t2t2.com/stat.js"></script>-->
  
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -