'通用图表创建程序 Function CreateChartTable(rst,intNodes,intRate,strTitle) Dim i,lngNode,BarString,NumString 'Dim intRate '比率换算,取最大值,如果最大值小于100,则比率为1;1000则为0.1;依次压缩 '特殊处理0月 strTitle=Replace(strTitle,"年0月","年度") Response.Write "<p> </p>" & Vbcrlf Response.Write "<table style=""border:1px #EEEEEE dotted;font-size:12px"" align=center>" Response.Write "<tr align=center colspan=31>"& strTitle &"</tr>" & VbCrlf For i=1 to intNodes rst.Filter="inode=" & i If rst.Eof Then lngNode=0 Else If IsNull(rst(0)) Then lngNode=0 Else lngNode=rst(0) End If End If BarString = BarString & "<td width=15 valign=baseline><img src=images/bar2.gif width=12 height=" & lngNode*intRate & " title=" & lngNode & "></td>" & VbCrlf NumString = NumString & "<td>" & i & "</td>" & VbCrlf Next Response.Write "<tr>" & BarString & "</tr>" & VbCrlf Response.Write "<tr>" & NumString & "</tr>" & VbCrlf Response.Write "</table>"& VbCrlf Response.Write "<p> </p>" & VbCrlf End Function
'判断收缩比率 Function JudgeRate(lngNum) If lngNum<=100 Then JudgeRate=1 ElseIf lngNum>100 And lngNum<=1000 Then JudgeRate=0.1 ElseIf lngNum>1000 And lngNum<=10000 Then JudgeRate=0.01 ElseIf lngNum>10000 And lngNum<=100000 Then JudgeRate=0.001 ElseIf lngNum>100000 And lngNum<=1000000 Then JudgeRate=0.0001 End If End Function
'调用图表开始 Set rst=oBlog.Execute("select Count(Userid),Month(adddate) As iNode From oBlog_User Where Year(adddate)=" & strYear& " Group By Month(adddate)") If rst.Eof Then lngMax=0 Else If IsNull(rst(0)) Then lngMax=0 Else lngMax=rst(0) End If End If Call CreateChartTable(rst,12,JudgeRate(lngMax),strYear & "年月度注册增长趋势") |