服务器之家:专注于服务器技术及软件下载分享
分类导航

PHP教程|ASP.NET教程|JAVA教程|ASP教程|

服务器之家 - 编程语言 - ASP教程 - ASP生成柱型体,折线图,饼图源代码

ASP生成柱型体,折线图,饼图源代码

2019-10-18 11:19asp代码网 ASP教程

ASP生成柱型体,折线图,饼图源代码分享,有需要的朋友可以参考一下。

  1. <%  
  2. function table2(total,table_x,table_y,all_width,all_height,line_no)  
  3. '参数含义(传递的数组,横坐标,纵坐标,图表的宽度,图表的高度,折线条数)  
  4. '纯ASP代码生成图表函数2——折线图  
  5. '作者:龚鸣(Passwordgm) QQ:25968152 MSN:passwordgm@sina.com Email:passwordgm@sina.com  
  6. '本人非常愿意和ASP,VML,FLASH的爱好者在HTTP://topclouds.126.com进行交流和探讨  
  7. '版本1.0 最后修改日期 2003-8-11  
  8. '非常感谢您使用这个函数,请您使用和转载时保留版权信息,这是对作者工作的最好的尊重。  
  9.     line_color="#69f"  
  10.     left_width=70  
  11.     total_no=ubound(total,1)  
  12.  
  13.     temp1=0  
  14.     for i=1 to total_no  
  15.         for j=1 to line_no  
  16.             if temp1<total(i,j) then temp1=total(i,j)  
  17.         next  
  18.     next  
  19.     temp1=int(temp1)  
  20.     if temp1>9 then  
  21.         temp2=mid(cstr(temp1),2,1)  
  22.         if temp2>4 then   
  23.             temp3=(int(temp1/(10^(len(cstr(temp1))-1)))+1)*10^(len(cstr(temp1))-1)  
  24.         else  
  25.             temp3=(int(temp1/(10^(len(cstr(temp1))-1)))+0.5)*10^(len(cstr(temp1))-1)  
  26.         end if  
  27.     else  
  28.         if temp1>4 then temp3=10 else temp3=5  
  29.     end if  
  30.     temp4=temp3  
  31.     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>"  
  32.     for i=0 to all_height-1 step all_height/5  
  33.         response.write "<v:line id='_x0000_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&"'/>"  
  34.         response.write "<v:line id='_x0000_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'/>"  
  35.         response.write ""  
  36.         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'>"  
  37.         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>"  
  38.         temp4=temp4-temp3/5  
  39.     next  
  40.     response.write "<v:line id='_x0000_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'/>"  
  41.     response.write "<v:line id='_x0000_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'/>"  
  42.  
  43.     dim line_code  
  44.     redim line_code(line_no,5)  
  45.     for i=1 to line_no  
  46.         line_temp=split(total(0,i),",")  
  47.         line_code(i,1)=line_temp(0)  
  48.         line_code(i,2)=line_temp(1)  
  49.         line_code(i,3)=line_temp(2)  
  50.         line_code(i,4)=line_temp(3)  
  51.         line_code(i,5)=line_temp(4)  
  52.     next  
  53.     for j=1 to line_no  
  54.         for i=1 to total_no-1  
  55.             x1=table_x+left_width+all_width*(i-1)/total_no  
  56.             y1=table_y+(temp3-total(i,j))*(all_height/temp3)  
  57.             x2=table_x+left_width+all_width*i/total_no  
  58.             y2=table_y+(temp3-total(i+1,j))*(all_height/temp3)  
  59.             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)&""">"  
  60.             select case line_code(j,3)  
  61.             case 1  
  62.             case 2  
  63.                 response.write "<v:stroke dashstyle='1 1'/>"  
  64.             case 3  
  65.                 response.write "<v:stroke dashstyle='dash'/>"  
  66.             case 4  
  67.                 response.write "<v:stroke dashstyle='dashDot'/>"  
  68.             case 5  
  69.                 response.write "<v:stroke dashstyle='longDash'/>"  
  70.             case 6  
  71.                 response.write "<v:stroke dashstyle='longDashDot'/>"  
  72.             case 7  
  73.                 response.write "<v:stroke dashstyle='longDashDotDot'/>"  
  74.             case else  
  75.             end select  
  76.             response.write "</v:line>"&CHR(13)  
  77.             select case line_code(j,4)  
  78.             case 1  
  79.             case 2  
  80.                 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)&"""/>"&CHR(13)  
  81.             case 3  
  82.                 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)&"""/>"&CHR(13)  
  83.             end select  
  84.         next  
  85.         select case line_code(j,4)  
  86.         case 1  
  87.         case 2  
  88.             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)&"""/>"&CHR(13)  
  89.         case 3  
  90.             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)&"""/>"&CHR(13)  
  91.         end select  
  92.     next  
  93.  
  94.     for i=1 to total_no  
  95.         response.write "<v:line id='_x0000_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'/>"  
  96.         response.write ""  
  97.         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'>"  
  98.         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>"  
  99.     next  
  100.  
  101.     tb_height=30  
  102.     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'/>"  
  103.     for i=1 to line_no  
  104.         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'>"  
  105.         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>"  
  106.         response.write "<v:rect id='_x0000_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='100%' type='gradient'/></v:rect>"  
  107.     next  
  108. end function  
  109.  
  110. function table1(total,table_x,table_y,thickness,table_width,all_width,all_height,table_type)  
  111. '参数含义(传递的数组,横坐标,纵坐标,柱子的厚度,柱子的宽度,图表的宽度,图表的高度,图表的类型)  
  112. '纯ASP代码生成图表函数1——柱状图  
  113. '作者:龚鸣(Passwordgm) QQ:25968152 MSN:passwordgm@sina.com Email:passwordgm@sina.com  
  114. '本人非常愿意和ASP,VML,FLASH的爱好者在HTTP://topclouds.126.com进行交流和探讨  
  115. '版本2.0 最后修改日期 2003-7-22  
  116. '非常感谢您使用这个函数,请您使用和转载时保留版权信息,这是对作者工作的最好的尊重。  
  117.     dim tb_color(7,2)  
  118.     tb_color(1,1)="#d1ffd1"  
  119.     tb_color(2,1)="#ffbbbb"  
  120.     tb_color(3,1)="#ffe3bb"  
  121.     tb_color(4,1)="#cff4f3"  
  122.     tb_color(5,1)="#d9d9e5"  
  123.     tb_color(6,1)="#ffc7ab"  
  124.     tb_color(7,1)="#ecffb7"  
  125.  
  126.     tb_color(1,2)="#00ff00"  
  127.     tb_color(2,2)="#ff0000"  
  128.     tb_color(3,2)="#ff9900"  
  129.     tb_color(4,2)="#33cccc"  
  130.     tb_color(5,2)="#666699"  
  131.     tb_color(6,2)="#993300"  
  132.     tb_color(7,2)="#99cc00"  
  133.  
  134.     line_color="#69f"  
  135.     left_width=70  
  136.     length=thickness/2  
  137.     total_no=ubound(total,1)  
  138.  
  139.     temp1=0  
  140.     for i=1 to total_no  
  141.         if temp1<total(i,1) then temp1=total(i,1)  
  142.     next  
  143.     temp1=int(temp1)  
  144.     if temp1>9 then  
  145.         temp2=mid(cstr(temp1),2,1)  
  146.         if temp2>4 then   
  147.             temp3=(int(temp1/(10^(len(cstr(temp1))-1)))+1)*10^(len(cstr(temp1))-1)  
  148.         else  
  149.             temp3=(int(temp1/(10^(len(cstr(temp1))-1)))+0.5)*10^(len(cstr(temp1))-1)  
  150.         end if  
  151.     else  
  152.         if temp1>4 then temp3=10 else temp3=5  
  153.     end if  
  154.     temp4=temp3  
  155.     response.write "<!--[if gte vml 1]><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><![endif]-->"  
  156.     response.write "<!--[if gte vml 1]><v:line id='_x0000_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'/><![endif]-->"  
  157.     response.write "<!--[if gte vml 1]><v:line id='_x0000_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'/><![endif]-->"  
  158.  
  159.     select case table_type  
  160.     case "A"  
  161.         table_space=(all_width-table_width*total_no)/total_no  
  162.         response.write "<!--[if gte vml 1]><v:line id='_x0000_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&"px' to='"&table_x+left_width+length&"px,"&table_y+all_height-length&"px' strokecolor='"&line_color&"'/><![endif]-->"  
  163.         for i=0 to all_height-1 step all_height/5  
  164.             response.write "<!--[if gte vml 1]><v:line id='_x0000_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-length-i&"px' to='"&table_x+left_width+length&"px,"&table_y+all_height-i&"px' strokecolor='"&line_color&"'/><![endif]-->"  
  165.             response.write "<!--[if gte vml 1]><v:line id='_x0000_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&"'/><![endif]-->"  
  166.             response.write "<!--[if gte vml 1]><v:line id='_x0000_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'/><![endif]-->"  
  167.             response.write "<!--[if gte vml 1]>"  
  168.             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'>"  
  169.             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><![endif]-->"  
  170.             temp4=temp4-temp3/5  
  171.         next  
  172.         for i=1 to total_no  
  173.             temp_space=table_x+left_width+table_space/2+table_space*(i-1)+table_width*(i-1)  
  174.             response.write "<v:rect id='_x0000_s1025' alt='' style='position:absolute;left:"  
  175.             response.write temp_space  
  176.             response.write "px;top:"  
  177.             response.write table_y+all_height*(1-(total(i,1)/temp3))  
  178.             response.write "px;width:"&table_width&"px;height:"&all_height*(total(i,1)/temp3)&"px;z-index:1' fillcolor='"&tb_color(i,2)&"'>"  
  179.             response.write "<v:fill color2='"&tb_color(i,1)&"' rotate='t' type='gradient'/>"  
  180.             response.write "<o:extrusion v:ext='view' backdepth='"&thickness&"pt' color='"&tb_color(i,2)&"' on='t'/>"  
  181.             response.write "</v:rect>"  
  182.             response.write "<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:"&temp_space&"px;top:"&table_y+all_height*(1-(total(i,1)/temp3))-table_width&"px;width:"&table_space+15&"px;height:18px;z-index:1'>"  
  183.             response.write "<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='center'>"&total(i,1)&"</td></tr></table></v:textbox></v:shape>"  
  184.  
  185.             response.write "<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:"&temp_space-table_space/2&"px;top:"&table_y+all_height+1&"px;width:"&table_space+table_width&"px;height:18px;z-index:1'>"  
  186.             response.write "<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='center'>"&total(i,2)&"</td></tr></table></v:textbox></v:shape>"  
  187.         next  
  188.     Case "B"  
  189.     table_space=(all_height-table_width*total_no)/total_no  
  190.     response.write "<!--[if gte vml 1]><v:line id='_x0000_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&"px' to='"&table_x+left_width+all_width&"px,"&table_y+all_height-length&"px' strokecolor='"&line_color&"'/><![endif]-->"  
  191.     for i=0 to all_width-1 step all_width/5  
  192.         response.write "<!--[if gte vml 1]><v:line id='_x0000_s1027' alt='' style='position:absolute;left:0;text-align:left;top:0;flip:y;z-index:-1' from='"&table_x+left_width+i&"px,"&table_y+all_height-length&"px' to='"&table_x+left_width+length+i&"px,"&table_y+all_height&"px' strokecolor='"&line_color&"'/><![endif]-->"  
  193.         response.write "<!--[if gte vml 1]><v:line id='_x0000_s1027' alt='' style='position:absolute;left:0;text-align:left;top:0;flip:y;z-index:-1' from='"&table_x+left_width+length+i&"px,"&table_y+all_height-length&"px' to='"&table_x+left_width+length+i&"px,"&table_y&"px' strokecolor='"&line_color&"'/><![endif]-->"  
  194.         response.write "<!--[if gte vml 1]><v:line id='_x0000_s1027' alt='' style='position:absolute;left:0;text-align:left;top:0;flip:y;z-index:-1' from='"&table_x+left_width+i+all_width/5&"px,"&table_y+all_height&"px' to='"&table_x+left_width+i+all_width/5&"px,"&table_y+all_height+15&"px'/><![endif]-->"  
  195.         response.write "<!--[if gte vml 1]>"  
  196.         response.write "<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:"&table_x+left_width+i+all_width/5-left_width&"px;top:"&table_y+all_height&"px;width:"&left_width&"px;height:18px;z-index:1'>"  
  197.         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><![endif]-->"  
  198.         temp4=temp4-temp3/5  
  199.     next  
  200.  
  201.     for i=1 to total_no  
  202.         temp_space=table_space/2+table_space*(i-1)+table_width*(i-1)  
  203.         response.write "<v:rect id='_x0000_s1025' alt='' style='position:absolute;left:"  
  204.         response.write table_x+left_width  
  205.         response.write "px;top:"  
  206.         response.write table_y+temp_space  
  207.         response.write "px;width:"&all_width*(total(i,1)/temp3)&"px;height:"&table_width&"px;z-index:1' fillcolor='"&tb_color(i,2)&"'>"  
  208.         response.write "<v:fill color2='"&tb_color(i,1)&"' rotate='t' angle='-90' focus='100%' type='gradient'/>"  
  209.         response.write "<o:extrusion v:ext='view' backdepth='"&thickness&"pt' color='"&tb_color(i,2)&"' on='t'/>"  
  210.         response.write "</v:rect>"  
  211.         response.write "<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:"&table_x+left_width+all_width*(total(i,1)/temp3)+thickness/2&"px;top:"&table_y+temp_space&"px;width:"&table_space+15&"px;height:18px;z-index:1'>"  
  212.         response.write "<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='center'>"&total(i,1)&"</td></tr></table></v:textbox></v:shape>"  
  213.  
  214.         response.write "<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:"&table_x&"px;top:"&table_y+temp_space&"px;width:"&left_width&"px;height:18px;z-index:1'>"  
  215.         response.write "<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='right'>"&total(i,2)&"</td></tr></table></v:textbox></v:shape>"  
  216.     next  
  217.     case else  
  218.     end select  
  219. end function  
  220.  
  221. function table3(total,table_x,table_y,all_width,all_height,table_type)  
  222. '参数含义(传递的数组,横坐标,纵坐标,图表的宽度,图表的高度,图表的类型)  
  223. '纯ASP代码生成图表函数3——饼图  
  224. '作者:龚鸣(Passwordgm) QQ:25968152 MSN:passwordgm@sina.com Email:passwordgm@sina.com  
  225. '本人非常愿意和ASP,VML,FLASH的爱好者在HTTP://topclouds.126.com进行交流和探讨  
  226. '版本1.0 最后修改日期 2003-8-11  
  227. '非常感谢您使用这个函数,请您使用和转载时保留版权信息,这是对作者工作的最好的尊重。  
  228.     tb_height=30  
  229.  
  230.     dim tb_color(7,2)  
  231.     tb_color(1,1)="#d1ffd1"  
  232.     tb_color(2,1)="#ffbbbb"  
  233.     tb_color(3,1)="#ffe3bb"  
  234.     tb_color(4,1)="#cff4f3"  
  235.     tb_color(5,1)="#d9d9e5"  
  236.     tb_color(6,1)="#ffc7ab"  
  237.     tb_color(7,1)="#ecffb7"  
  238.  
  239.     tb_color(1,2)="#00ff00"  
  240.     tb_color(2,2)="#ff0000"  
  241.     tb_color(3,2)="#ff9900"  
  242.     tb_color(4,2)="#33cccc"  
  243.     tb_color(5,2)="#666699"  
  244.     tb_color(6,2)="#993300"  
  245.     tb_color(7,2)="#99cc00"  
  246.  
  247.     total_no=ubound(total,1)  
  248.     totalpie=0  
  249.     for i=1 to total_no  
  250.         totalpie=totalpie+total(i,1)  
  251.     next  
  252.  
  253.     PreAngle=0  
  254.     for i=1 to total_no  
  255.         response.write "<v:shape id='_x0000_s1025' alt='' style='position:absolute;left:"&table_x&"px;top:"&table_y&"px;width:"&all_width&"px;height:"&all_height&"px;z-index:1' coordsize='1500,1400' o:spt='100' adj='0,,0' path='m750,700ae750,700,750,700,"&int(23592960*PreAngle)&","&int(23592960*total(i,1)/totalpie)&"xe' fillcolor='"&tb_color(i,1)&"' strokecolor='#FFFFFF'><v:fill color2='"&tb_color(i,2)&"' rotate='t' focus='100%' type='gradient'/><v:stroke joinstyle='round'/><v:formulas/><v:path o:connecttype='segments'/></v:shape>"&CHr(13)  
  256.         PreAngle=PreAngle+total(i,1)/totalpie  
  257.     next  
  258.  
  259.     if table_type="A" then  
  260.         response.write "<v:rect id='_x0000_s1025' style='position:absolute;left:"&table_x+all_width+20&"px;top:"&table_y+20&"px;width:100px;height:"&total_no*tb_height+20&"px;z-index:1'/>"  
  261.         for i=1 to total_no  
  262.             response.write "<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:"&table_x+all_width+25&"px;top:"&table_y+30+(i-1)*tb_height&"px;width:60px;height:"&tb_height&"px;z-index:1'>"  
  263.             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>"  
  264.             response.write "<v:rect id='_x0000_s1040' alt='' style='position:absolute;left:"&table_x+all_width+80&"px;top:"&table_y+30+(i-1)*tb_height+3&"px;width:30px;height:20px;z-index:1' fillcolor='"&tb_color(i,1)&"'><v:fill color2='"&tb_color(i,2)&"' rotate='t' focus='100%' type='gradient'/></v:rect>"  
  265.             '显示比例数  
  266.             ' response.write "<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:"&table_x+all_width+110&"px;top:"&table_y+30+(i-1)*tb_height&"px;width:60px;height:"&tb_height&"px;z-index:1'>"  
  267.             ' response.write "<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='left'>"&formatnumber(total(i,1)*100/totalpie,2,-1)&"%</td></tr></table></v:textbox></v:shape>"  
  268.         next  
  269.     end if  
  270.  
  271.     if table_type="B" then  
  272.         pie=3.14159265358979  
  273.         TempPie=0  
  274.         for i=1 to total_no  
  275.             TempAngle=pie*2*(total(i,1)/(TotalPie*2)+TempPie)  
  276.             x1=table_x+all_width/2+cos(TempAngle)*all_width*3/8  
  277.             y1=table_y+all_height/2-sin(TempAngle)*all_height*3/8  
  278.             x2=table_x+all_width/2+cos(TempAngle)*all_width*3/4  
  279.             y2=table_y+all_height/2-sin(TempAngle)*all_height*3/4  
  280.             if x2>table_x+all_width/2 then  
  281.                 x3=x2+20  
  282.                 x4=x3  
  283.             else  
  284.                 x3=x2-20  
  285.                 x4=x3-100  
  286.             end if  
  287.             response.write "<v:oval id='_x0000_s1027' style='position:absolute;left:"&x1-2&"px;top:"&y1-2&"px;width:4px;height:4px; z-index:2' fillcolor='#111111' strokecolor='#111111'/>"&CHR(13)  
  288.             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='#111111' strokeweight='1px'></v:line>"  
  289.             response.write "<v:line id='_x0000_s1025' alt='' style='position:absolute;left:0;text-align:left;top:0;z-index:1' from='"&x2&"px,"&y2&"px' to='"&x3&"px,"&y2&"px' coordsize='21600,21600' strokecolor='#111111' strokeweight='1px'></v:line>"  
  290.             response.write "<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:"&x4&"px;top:"&y2-10&"px;width:100px;height:20px;z-index:1'>"  
  291.             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)&" "&formatnumber(total(i,1)*100/totalpie,2,-1)&"%</td></tr></table></v:textbox></v:shape>"  
  292.             TempPie=TempPie+total(i,1)/TotalPie  
  293.         next  
  294.     end if  
  295. end function  
  296. %>  
  297.  
  298. 纯ASP代码生成图表函数1——柱状图调用示例  
  299. <%  
  300. dim total(7,2)  
  301. total(1,1)=200  
  302. total(2,1)=800  
  303. total(3,1)=1000  
  304. total(4,1)=600  
  305. total(5,1)=1222  
  306. total(6,1)=3213  
  307. total(7,1)=8  
  308.  
  309. total(1,2)="中国经营报"  
  310. total(2,2)="招聘网"  
  311. total(3,2)="51Job"  
  312. total(4,2)="新民晚报"  
  313. total(5,2)="新闻晚报"  
  314. total(6,2)="南方周末"  
  315. total(7,2)="羊城晚报"  
  316.  
  317. total_no=7  
  318. %>  
  319. <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">  
  320. <!--[if !mso]>  
  321. <style>  
  322. v\:* { behavior: url(#default#VML) }  
  323. o\:* { behavior: url(#default#VML) }  
  324. .shape { behavior: url(#default#VML) }  
  325. </style>  
  326. <![endif]-->  
  327. <head>  
  328. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">  
  329. <title></title>  
  330. <style>  
  331. TD { FONT-SIZE: 9pt}  
  332. </style></head>  
  333.  
  334. <body topmargin=5 leftmargin=0 scroll=AUTO>  
  335. <%call table1(total,200,20,20,30,400,200,"A")%>  
  336. <%call table1(total,200,320,20,20,400,250,"B")%>  
  337. </body>  
  338. </html>  

延伸 · 阅读

精彩推荐