ASP generates column bodies, line charts, and pie charts. the source code of the pie chart provides page 1/3.

Source: Internet
Author: User

ASP generates column bodies, line charts, and pie chart source code
<%
Function table2 (total, table_x, table_y, all_width, all_height, line_no)
'Parameter meaning (transmitted array, abscissa, ordinate, chart width, chart height, number of broken lines)
'Function 2 for generating charts using ASP-only codes -- line chart
'Author: Passwordgm QQ: 25968152 MSN: passwordgm@sina.com Email: passwordgm@sina.com
'I am very willing to discuss with ASP, VML, and FLASH fans at HTTP: // topclouds.126.com.
'Version 1.0 last modified on
'Thank you very much for using this function. Please retain the copyright information when you use and repost it. This is the best respect for the work of the author.

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 (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
Temp4 = temp3
Response. write "<v: rect id = '_ xforwar_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 = '000000' type = 'gradient'/> </v: rect>"
For I = 0 to the all_height-1 step all_height/5
Response. write "<v: line id = '_ xforwar_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 &"'/>"
Response. write "<v: line id = '_ xforwar_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 '/>"
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 = '000000' height = '000000'> <tr> <td align = 'right'> "& temp4 & "</td> </tr> </table> </v: textbox> </v: shape>"
Temp4 = temp4-temp3/5
Next
Response. write "<v: line id = '_ xforwar_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 '/>"
Response. write "<v: line id = '_ xforwar_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 '/>"

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 =" "_ x1__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 = 'longflash'/>"
Case 6
Response. write "<v: stroke dashstyle = 'longdashdot '/>"
Case 7
Response. write "<v: stroke dashstyle = 'longdashdotdot '/>"
Case else
End select
Response. write "</v: line>" & CHR (13)
Select case line_code (j, 4)
Case 1
Case 2
Response. write "<v: rect id =" "_ x1__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) & ""/> "& CHR (13)
Case 3
Response. write "<v: oval id =" "_ x1__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) & ""/> "& CHR (13)
End select
Next
Select case line_code (j, 4)
Case 1
Case 2
Response. write "<v: rect id =" "_ x1__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) & ""/> "& CHR (13)
Case 3
Response. write "<v: oval id =" "_ x1__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) & ""/> "& CHR (13)
End select
Next

For I = 1 to total_no
Response. write "<v: line id = '_ xforwar_s1027' alt ='' style = 'position: absolute; left: 0; text-align: left; top: 0; flip: y; 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 = '000000' height = '000000'> <tr> <td align = 'left'> "& total (I, 0) & "</td> </tr> </table> </v: textbox> </v: shape>"
Next

Tb_height = 30
Response. write "<v: rect id = '_ xforwar_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 = '000000' height = '000000'> <tr> <td align = 'left'> "& line_code (I, 5) & "</td> </tr> </table> </v: textbox> </v: shape>"
Response. write "<v: rect id = '_ xforwar_s1040' alt ='' style = 'position: absolute; left: "& 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 = '000000' type = 'gradient'/> </v: rect>"
Next

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.