ASP Generation Line Chart

Source: Internet
Author: User
Line chart

Method One:

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


Total (0,1) = "#FF0000, 1.5,1,2, Company 1" ' Parameter 1 line color, parameter 2 line width, parameter 3 line type, parameter 4 turning type, parameter 5 line name
Total (1,1) =200
Total (2,1) =1200
Total (3,1) =900
Total (4,1) =600
Total (5,1) =1222
Total (6,1) =413
Total (7,1) =800

Total (0,2) = "#0000FF, 1,2,3, Company 2"
Total (1,2) =400
Total (2,2) =500
Total (3,2) =1040
Total (4,2) =1600
Total (5,2) =522
Total (6,2) =813
Total (7,2) =980

Total (0,3) = "#004D00, 1,1,3, company 3"
Total (1,3) =900
Total (2,3) =890
Total (3,3) =1240
Total (4,3) =1300
Total (5,3) =722
Total (6,3) =833
Total (7,3) =1280

%><!--[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 table2 (total,100,90,600,250,3)%>
</body>

<%
function Table2 (total,table_x,table_y,all_width,all_height,line_no)
' parameter meaning (passed array, horizontal axis, ordinate, chart width, chart height, fold line number)
' Pure ASP code generation chart function 2--line chart
' Author: 龚鸣 (PASSWORDGM) qq:25968152 msn:passwordgm@sina.com email:passwordgm@sina.com
I am very willing to communicate and discuss with Asp,vml,flash enthusiasts in HTTP://topclouds.126.com.
' Version 1.0 last modification date 2003-8-11
' 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.

Line_color= "#69f"
Left_width=70
Total_no=ubound (total,1)

Temp1=0
For I=1 to Total_no
For J=1 to Line_no
If Temp1<total (i,j) then Temp1=total (i,j)
Next
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 "<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> '
For i=0 to All_height-1 step ALL_HEIGHT/5
Response.Write "<v:line id= ' _x0000_s1027 ' alt= ' style= '; 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 & "'/>"
Response.Write "<v:line id= ' _x0000_s1027 ' alt= ' style= '; Z-index:-1 ' from= ' "&table_x+ (left_width-15) &" px, "&table_y+i&" px ' to= ' "&table_x+left_width & "px," &table_y+i& "px '/>"
Response.Write ""
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> "
Temp4=temp4-temp3/5
Next
Response.Write "<v:line id= ' _x0000_s1027 ' alt= ' style= '; 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 '/>"
Response.Write "<v:line id= ' _x0000_s1027 ' alt= ' style= '; Z-index:-1 ' from= ' "&table_x+left_width&" px, "&table_y&" px ' to= ' "&table_x+left_width&" px, " &table_y+all_height& "px '/>"

Dim Line_code
ReDim Line_code (line_no,5)
For I=1 to Line_no
Line_temp=split (Total (0,i), ",")
Line_code (i,1) =line_temp (0)
Line_code (i,2) =line_temp (1)
Line_code (i,3) =line_temp (2)
Line_code (i,4) =line_temp (3)
Line_code (i,5) =line_temp (4)
Next
For J=1 to Line_no
For I=1 to Total_no-1
x1=table_x+left_width+all_width* (i-1)/total_no
y1=table_y+ (Temp3-total (I,J)) * (All_height/temp3)
X2=table_x+left_width+all_width*i/total_no
y2=table_y+ (Temp3-total (I+1,J)) * (All_height/temp3)
Response.Write "<v:line id=" "_x0000_s1025" "alt=" "" Style= ' position:absolute;left:0;text-align:left;top:0; Z-index:1 ' from= ' "" &x1& "px," &y1& "px" "to=" "" &x2& "px," &y2& "px" "coordsize=" 21600,21600 "" strokecolor= "" "&line_code (j,1) &" "Strokeweight=" "&line_code (j,2) &" ">"
Select Case Line_code (j,3)
Case 1
Case 2
Response.Write "<v:stroke dashstyle= ' 1 1 '/>"
Case 3
Response.Write "<v:stroke dashstyle= ' dash '/>"
Case 4
Response.Write "<v:stroke dashstyle= ' Dashdot '/>"
Case 5
Response.Write "<v:stroke dashstyle= ' Longdash '/>"
Case 6
Response.Write "<v:stroke dashstyle= ' Longdashdot '/>"
Case 7
Response.Write "<v:stroke dashstyle= ' Longdashdotdot '/>"
Case Else
End Select
Response.Write "</v:line>" &AMP;CHR (13)
Select Case Line_code (j,4)
Case 1
Case 2
Response.Write "<v:rect id=" "_x0000_s1027" "Style= ' Position:absolute;left": "&x1-2&" Px;top: "&y1-2 & "PX;WIDTH:4PX;HEIGHT:4PX; Z-index:2 ' fillcolor= ' "" &line_code (j,1) & "" Strokecolor= "" "&line_code (j,1) &" "/>" &AMP;CHR (13)
Case 3
Response.Write "<v:oval id=" "_x0000_s1026" "Style= ' Position:absolute;left": "&x1-2&" Px;top: "&y1-2 & "Px;width:4px;height:4px;z-index:1 ' fillcolor=" "&line_code (j,1) &" "Strokecolor=" "" &line_code ( j,1) & "" "/>" &AMP;CHR (13)
End Select
Next
Select Case Line_code (j,4)
Case 1
Case 2
Response.Write "<v:rect id=" "_x0000_s1027" "Style= ' Position:absolute;left": "&x2-2&" Px;top: "&y2-2 & "PX;WIDTH:4PX;HEIGHT:4PX; Z-index:2 ' fillcolor= ' "" &line_code (j,1) & "" Strokecolor= "" "&line_code (j,1) &" "/>" &AMP;CHR (13)
Case 3
Response.Write "<v:oval id=" "_x0000_s1026" "Style= ' Position:absolute;left": "&x2-2&" Px;top: "&y2-2 & "Px;width:4px;height:4px;z-index:1 ' fillcolor=" "&line_code (j,1) &" "Strokecolor=" "" &line_code ( j,1) & "" "/>" &AMP;CHR (13)
End Select
Next

For I=1 to Total_no
Response.Write "<v:line id= ' _x0000_s1027 ' alt= ' style= '; Z-index:-1 ' from= ' "&table_x+left_width+all_width* (i-1)/total_no&" px, "&table_y+all_height& px" to = ' "&table_x+left_width+all_width* (i-1)/total_no&" px, "&table_y+all_height+15&" px '/> "
Response.Write ""
Response.Write "<v:shape id= ' _x0000_s1025 ' type= ' #_x0000_t202 ' alt= ' style= ' position:absolute;left:" &table_ x+left_width+all_width* (i-1)/total_no& "px;top:" &table_y+all_height& "Px;width:" &all_width/total _no& "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= ' left ' > ' &total (i,0) & "</td></tr></table> </v:textbox></v:shape> "
Next

Tb_height=30
Response.Write "<v:rect id= ' _x0000_s1025 ' style= ' position:absolute;left:" &table_x+all_width+20& "px;top : "&table_y&" Px;width:100px;height: "&line_no*tb_height+20&" Px;z-index:1 '/> "
For I=1 to Line_no
Response.Write "<v:shape id= ' _x0000_s1025 ' type= ' #_x0000_t202 ' alt= ' style= ' position:absolute;left:" &table_ x+all_width+25& "Px;top:" &table_y+10+ (i-1) *tb_height& "px;width:60px;height:" &tb_height& "PX; Z-index:1 ' > '
Response.Write "<v:textbox inset= ' 0px,0px,0px,0px ' ><table cellspacing= ' 3 ' cellpadding= ' 0 ' width= ' 100% ' height= ' 100% ' ><tr><td align= ' left ' > ' &line_code (i,5) & "</td></tr></table ></v:textbox></v:shape> "
Response.Write "<v:rect id= ' _x0000_s1040 ' alt= ' style= ':" &table_x+all_width+80& " Px;top: "&table_y+10+ (i-1) *tb_height+4&" Px;width:30px;height:20px;z-index:1 ' fillcolor= ' "&line_code" ( i,1) & "' ><v:fill color2= '" &line_code (i,1) & "' rotate= ' t ' focus= ' 100% ' type= ' ' gradient '"/></v: Rect> "
Next

End Function
%>

Method Two:

<%
' Do not modify the following data unless you know what you are doing
'#####################################

height=200 '//Chart height
width=600 '//Chart width

POSX=390-WIDTH/2 '//relative to the X position of the browser
Posy=70 '//relative to the Y position of the browser

Scalex=50 '//preferably a multiple of the width value
Scaley=50 '//preferably a multiple of the height value

Countx=cint (Width/scalex)
County=cint (Height/scaley)

Data= "50,50|100,120|200,150|300,50|450,100"//To enter a dotted line (vertical bar separates each group, comma separates X and Y values in each group)

Tempdata=split (data, "|")
Tempdatacount=ubound (TempData) +1


%>



<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<!--coding by pypstudio-->
<title> Line Chart Generation </title>
<style type= "Text/css" >
<!--
. upperline {
border-bottom-width:1px;
Border-top-style:none;
Border-right-style:none;
Border-bottom-style:solid;
Border-left-style:none;
Border-bottom-color: #FF0000;
}
-->
</style>

<body>
<table width= "80%" border= "0" align= "center" cellpadding= "0" cellspacing= "1" class= "Upperline" >
<tr>
<TD height= align= "center" ></tr>
</table>
<!--Generate Line chart start-->

<!--[If!mso]>
<style>
V\:*



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.