ASP graph generates instance code

Source: Internet
Author: User

<!--#include file= "adoconn.asp Tutorial"-->

<title> Curve Statistics </title>
<STYLE>
v:* {behavior:url (#default #vml)}
o:* {behavior:url (#default #vml)}
</STYLE>
<script language= "JavaScript" >
<!--
var showit = new Array (10);
function MoveOn (Iteam,lineit) {
Temp=eval (Iteam)
Templine=eval (Lineit)
if (Showit[1]) {
Rec1.style.display = "";
Line_1.style.display = "";
}else{
Rec1.style.display = "None";
Line_1.style.display = "None";
}
Temp.style.display = "";
Templine.style.display = "";
}
function Moveout (iteam,lineit,i) {
Temp=eval (Iteam)
Templine=eval (Lineit)
if (Showit[i]) {
Temp.style.display = "";
Templine.style.display = "";
}else{
Temp.style.display = "None";
Templine.style.display = "None";
}
}
function Clickit (i) {
if (Showit[i]) {
Showit[i]=false
}else{
Showit[i]=true
}
}
-->
</script>

<body>
<%
'''''''''''''''''''''''''''''''''''''''''''''
' Function: ASP read database tutorial data generation Statistics Line chart
' Development: Wangsdong
' Address: www.111cn.net
' Support original, keep this information, thank you
'''''''''''''''''''''''''''''''''''''''''''''
Date1=cdate ("2008-01-01 00:00:00")
Date2=cdate ("2008-12-31 23:59:59")
Sql= "Select sum (m_value) as T,m_month from table1 where m_time>=#" &date1& "# and m_time<=#" &date2& "# Group BY M_month"
Rs.Open sql,conn,1,1
If Rs.eof Then
Else
ReDim Total (1,2)
S= ""
V1= ""
Do as not rs.eof
s=s& "," &rs ("M_month") & "Month"
v1=v1& "," &rs ("T")
Rs.movenext
Loop
Total (0,1) =right (S,len (s)-1)
Total (1,1) =right (V1,len (v1)-1)
Total (1,2) = "2008 Year Performance Map"
End If
Rs.close
Set rs=nothing
Call table1 (total,20,20,700,350, "curve chart", "Time", "Yuan")
%>
</body>

ASP code

<%
Dim connstr
Dim Conn
' On Error Resume Next
m=1
If m=1 Then
db= ' 111.mdb '
 path=s Erver. MapPath (DB)
 set conn=server.createobject ("ADODB. Connection ")
 connstr=" Provider=Microsoft.Jet.OLEDB.4.0;Data source= "&path
 conn. Open connstr
Else
 connstr= "Provider = SQLOLEDB; User ID = "&" sa "&"; Password = "&" FUCKCHC "&"; Initial Catalog = "&" Tianyipt "&"; Data Source = "&" Server "&";
 connstr= "Provider = SQLOLEDB; User ID = "&" sa "&"; Password = "&" "&"; Initial Catalog = "&" AAAA "&"; Data Source = "&" localhost "&";
  ' connstr= ' Provider = SQLOLEDB; User ID = "&" sa "&"; Password = "&" "&"; Initial Catalog = "&" MyDB "&"; Data Source = "&" localhost "&";
 set conn = Server.CreateObject ("ADODB. Connection ")
 conn.open connstr
End If

Set Rs=server. CreateObject ("Adodb.recordset")


' ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
' ┃┃
' ┃ Summary: Statistical graph--graph ┃
' ┃ Author: Hongyun Soldier ┃
' ┃ Date Created: December 01, 2004 ┃
' ┃ finish date: November 03, 2004 ┃
' ┃┃
' ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
' parameter meaning (array, horizontal axis, ordinate, chart width, chart height, chart title, X axis unit, Y axis unit)
function table1 (stat_array,table_left,table_top,all_width,all_height,table_title,x_unit,y_unit)
Dim Bg_color (10)
Bg_color (1) = "#ff1919"
Bg_color (2) = "#ffff19"
Bg_color (3) = "#1919ff"
Bg_color (4) = "#19ff19"
Bg_color (5) = "#fc0"
Bg_color (6) = "#3cc"
Bg_color (7) = "#ff19ff"
Bg_color (8) = "#993300"
Bg_color (9) = "#f60"
Bg_color (a) = "#ff8c19"
If X_unit <> "" Then
X_unit = X_unit
End If
If Y_unit <> "" Then
Y_unit = Y_unit
End If
NUM1 = UBound (stat_array,1)
Line_temp=split (Stat_array (0,1), ",")
num2 = UBound (line_temp,1) +1
Dim Line_code
ReDim Line_code (NUM1,NUM2)
For J=1 to Num2
Line_code (0,j) = Line_temp (j-1)
Next
For I=1 to NUM1
Line_temp = Split (Stat_array (i,1), ",")
Line_code (i,0) = Stat_array (i,2)
For J=1 to Num2
Line_code (i,j) = CDbl (Line_temp (j-1))
Next
Next
Value_max=0
For I=1 to NUM1
For J=1 to Num2
If Value_max<line_code (i,j) then Value_max=line_code (i,j)
Next
Next
Value_max = CInt (Value_max)
Value_max_str =cstr (Value_max)
If Value_max>9 Then
Temp=mid (value_max_str,2,1)
If Temp>4 Then
temp2= (int (value_max/(10^ len (VALUE_MAX_STR)-1)) +1) *10^ (Len (VALUE_MAX_STR)-1)
Else
temp2= (int (value_max/(10^ len (VALUE_MAX_STR)-1)) +0.5) *10^ (Len (VALUE_MAX_STR)-1)
End If
Else
If Value_max>4 then temp2=10 else temp2=5
End If
Item_hight = TEMP2/5
Item_width = 20000/(num2-1)
Response. Write "<v:rect id= ' background ' style= ' position:absolute;left:" &table_left& "Px;top:" &table_top& "PX; WIDTH: "&all_width&" PX; HEIGHT: "&all_height&" px; ' fillcolor= ' #EFEFEF ' strokecolor= ' Gray ' > '
Response. Write "<v:shadow on= ' t ' type= ' single ' color= ' Silver ' offset= ' 4pt,4pt '"/> "
Response. Write "</v:rect>"
Response. Write "<v:group id= ' table ' style= ' position:absolute;left:" &table_left& "Px;top:" &table_top& "PX; WIDTH: "&all_width&" PX; HEIGHT: "&all_height&" px; ' coordsize = ' 27500,12800 ' > '
Response. Write "<v:rect style= ' position:relative;left:1500;top:200;width:23000;height:800 ' filled= ' false ' stroked= ' F ' > "
Response. Write "<v:textbox inset= ' 0pt,0pt,0pt,0pt ' >"
Response. Write "<table width= ' 100% ' border= ' 0 ' align= ' center ' cellspacing= ' 0 ' >"
Response. Write "<tr>"
Response. Write "<td align= ' center ' valign= ' middle ' ><div style= ' font-size:15pt; Font-family: Bold; ' ><B> "&table_title&" </B></div></td> "
Response. Write "</tr>"
Response. Write "</table>"
Response. Write "</v:TextBox>"
Response. Write "</v:Rect>"
Response. Write "<v:rect id= ' back ' style= ' position:relative;left:1700;top:1200;width:20500; height:10500 ' fillcolor= ' #9cf ' strokecolor= ' #DFDFDF ' > '
Response. Write "<v:fill rotate= ' t ' angle= ' -45 ' focus= ' 100% ' type= ' gradient '"/> "
Response. Write "</v:rect>"
Response. Write "<v:rect id= ' back2 ' style= ' position:relative;left:23000;top:1200;width:4000; Height: "& (10500) &"; ' fillcolor= ' #9cf ' stroked= ' t ' strokecolor= ' #0099ff ' > '
Response. Write "<v:fill rotate= ' t ' angle= ' -175 ' focus= ' 100% ' type= ' gradient '"/> "
Response. Write "<v:shadow on= ' t ' type= ' single ' color= ' Silver ' offset= ' 3pt,3pt '"/> "
Response. Write "</v:rect>"
For I=1 to NUM1
If I=1 Then
Displaystr= ""
Else
Displaystr= "None"
End If
Response. Write "<div style= ' Cursor:hand ' onmouseover= ' MoveOn (rec" &i& ", Line_" &i& ") ' Onmouseout= ' Moveout ( Rec "&i&", Line_ "&i&", "&i&") ' onclick= ' Clickit ("&i&") ' > '
Response. Write "<v:rect id= ' rec" &i& "' style= ' Position:relative;left:23100;top:" & (I-1) *10200/10+1450& "; Width:3800;height:800;display: "&displaystr&"; ' fillcolor= ' #efefef ' strokecolor= ' "&bg_color (i) &" ' > "
Response. Write "<v:fill opacity= '. 6 ' color2= ' Fill darken (118) ' o:opacity2= '. 6 ' rotate= ' t ' method= ' linear sigma ' focus= ' 100% ' t ype= ' gradient '/> '
Response. Write "</v:Rect>"
Response. Write "<v:rect style= ' Position:relative;left:23200;top:" & (I-1) *10200/10+1500& "; width:600;height:700 ' Fillcolor= ' "&bg_color (i) &" ' stroked= ' F '/> "
Response. Write "<v:rect style= ' Position:relative;left:24000;top:" & (I-1) *10200/10+1500& "; width:3400;height:700 ' Filled= ' F ' stroked= ' f ' > '
Response. Write "<v:textbox inset= ' 0pt,4pt,0pt,0pt ' style= ' font-size:9pt; ' ><div align= ' left ' > ' &stat_array (i,2) & "</div></v:TextBox>"
Response. Write "</v:Rect>"
Response. Write "</div>"
Next
Response. Write "<v:line id= ' X ' from= ' 1700,11700 ' to= ' 22700,11700 ' style= ' z-index:2 ', ' strokecolor= ' #000000 ' strokeweight=1pt ><v:stroke endarrow= ' Classic '/></v:line> '
Response. Write "<v:line id= ' Y ' from= ' 1700,900 ' to= ' 1700,11700 ' style= ' z-index:2 ', ' strokecolor= ' #000000 ' strokeweight=1pt> <v:stroke startarrow= ' Classic '/></v:line> '
Response. Write "<v:rect style= ' position:relative;left:100;top:700;width:1500;height:500 ' filled= ' false ' stroked= ' false ' > "
Response. Write "<v:textbox inset= ' 0pt,0pt,0pt,0pt ' style= ' font-size:9pt; ' ><div align= ' right ' > ' &Y_unit& ' </div></v:TextBox> '
Response. Write "</v:Rect>"
Response. Write "<v:rect style= ' position:relative;left:22200;top:11900;width:2000;height:500 ' filled= ' false ' stroked= ' False ' > '
Response. Write "<v:textbox inset= ' 0pt,0pt,0pt,0pt ' style= ' font-size:9pt; ' ><div align= ' left ' > ' &X_unit& ' </div></v:TextBox> '
Response. Write "</v:Rect>"
For I=0 to 4
Response. Write "<v:line from= ' 1300," &i*2000+1700& "' to= ' 1700," &i*2000+1700& "' style= ' z-index:2 ' Strokecolor= ' #000000 ' ></v:line> '
Response. Write "<v:line from= ' 1700," &i*2000+1700& "' to= ' 2200," &i*2000+1200& "' style= ' z-index:2 ' Strokecolor= ' #0099FF ' ></v:line> '
Response. Write "<v:line from= ' 2200," &i*2000+1200& "' to= ' 22200," &i*2000+1200& "' style= ' z-index:2 ' Strokecolor= ' #0099FF ' ></v:line> '
Response. Write "<v:line from= ' 2200," &i*2000+2200& "' to= ' 22200," &i*2000+2200& "' style= ' z-index:2 ' Strokecolor= ' #0099FF ' > '
Response. Write "<v:stroke dashstyle= ' Dot '/>"
Response. Write "</v:line>"
Response. Write "<v:rect style= ' position:relative;left:100;top:" &i*2000+1250& "; width:1500;height:500 ' filled= ' False ' stroked= ' false ' > '
Response. Write "<v:textbox inset= ' 0pt,0pt,0pt,0pt ' style= ' font-size:9pt; ' ><div align= ' right ' > ' &item_hight* (5-i) & "</div></v:TextBox>"
Response. Write "</v:Rect>"
Next
Response. Write "<v:line from= ' 2200,11200" to= ' 22200,11200 ' style= ' z-index:2 ' strokecolor= ' #0099FF ' ></v:line> '
Response. Write "<v:line from= ' 2200,1200" to= ' 2200,11200 ' style= ' z-index:2 ' strokecolor= ' #0099FF ' ></v:line> '
Response. Write "<v:line from= ' 1700,11700" to= ' 2200,11200 ' style= ' z-index:2 ' strokecolor= ' #0099FF ' ></v:line> '
For J=0 to Num2-1
Response. Write "<v:line from= '" &j*item_width+1700& ", 11700 ' to= '" &j*item_width+1700& ", 12000 ' style= ' Z-index:2 ' strokecolor= ' #000000 ' ></v:line> '
Response. Write "<v:line from= '" &j*item_width+1700& ", 11700 ' to= '" &j*item_width+2200& ", 11200 ' style= ' Z-index:2 ' strokecolor= ' #0099FF ' ><v:stroke dashstyle= ' Shortdot '/></v:line> '
Response. Write "<v:line from= '" &j*item_width+2200& ", 1200 ' to= '" &j*item_width+2200& ", 11200 ' style= ' Z-index:2 ' strokecolor= ' #0099FF ' ><v:stroke dashstyle= ' Shortdot '/></v:line> '
Response. Write "<v:rect style=" Position:relative;left: "&j*item_width+1700-item_width/2&"; Top:12100;width: " &item_width& height:500 ' filled= ' false ' stroked= ' false ' > '
Response. Write "<v:textbox inset= ' 0pt,0pt,0pt,0pt ' style= ' font-size:9pt; ' ><div align= ' center ' > ' &line_code (0,j+1) & "</div></v:TextBox>"
Response. Write "</v:Rect>"
Next
For I=1 to NUM1
If I=1 Then
Displaystr= ""
Else
Displaystr= "None"
End If
Response. Write "<div id= ' Line_" &i& "' style= ' Display:" &displaystr& "; ' > "
For J=0 to Num2-2
this_hight1 = CInt (Line_code (i,j+1)/(5*item_hight) *10000)
This_hight2 = CInt (Line_code (i,j+2)/(5*item_hight) *10000)
' Line style
Response. Write "<v:line from= '" &j*item_width+1850& "," & (10000-this_hight1+1550) & "To= '" & (j+1) *item_ width+1850& "," & (10000-this_hight2+1550) & "' style= ' Z-index:" &i*10& "; ' strokeweight= ' 0.1pt ' Strokecolor= ' "&bg_color (i) &" ' > "
Response. Write "<o:extrusion v:ext= ' view ' backdepth= ' 2pt ' on= ' t ' lightposition= ' -50000,-50000 ' lightposition2= ' ' 50000 '"/> "
Response. Write "</v:line>"
Next
Response. Write "</div>"
Next
Response. Write "</v:group>"
End Function
%>

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.