使用Java在Web上实现简易干特图之六

来源:互联网 发布:顽固软件卸载工具 编辑:程序博客网 时间:2024/05/22 00:09
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

表格6)的代码是再jindubiao.jsp页面的合适位置绘图。它是通过获得的三个时间段数据来绘图的,图中的duan0.gifduan1.gifduan2.gif-是一个和很小的与页面表格设计时表时间的的列有成比关系的小图形,也就是说在相等的时间段这个图形的越小代表刻度越小,所以这个图形会影响精度。但是在实例制作过程中,进度可以做到比较准确,相差在0.2-0.lduan1.gif单位。肉眼看不出来。

jindubiao.jsp中的部分代码

<!--开始绘图-->                        

<table width="100%" cellspacing=0 cellpadding=0>

   <tr>                       

       <%

              try{

                     for(int i=0;i<Integer.parseInt(myall[0][2]+"");i++)

                         out.println("<td background='../images/duan0.gif'>&nbsp;</td>");

                     for(int i=0;i<Integer.parseInt(myall[0][4]+"");i++)

                         out.println("<td height=2 background='../images/duan1.gif'>&nbsp;</td>");                     for(int i=0;i<Integer.parseInt(myall[0][3]+"");i++)

                            out.println("<td background='../images/duan0.gif'>&nbsp;</td>");

              }catch(Exception ex){

              }                                  

       %>

  </tr>

</table>

<table width="100%" cellspacing=0 cellpadding=0>

  <tr>

   <%

       try{

                     for(int i=0;i<Integer.parseInt(myall2[0][2]+"");i++)

                            out.println("<td background='../images/duan0.gif'>&nbsp;</td>");

                     for(int i=0;i<Integer.parseInt(myall2[0][4]+"");i++)

                            out.println("<td height=2 background='../images/duan2.gif'>&nbsp;</td>");                     for(int i=0;i<Integer.parseInt(myall2[0][3]+"");i++)

                            out.println("<td background='../images/duan0.gif'>&nbsp;</td>");                         }catch(Exception ex){

              }    

       %>

 </tr>

</table>

(表格6

同理,每一行变化的只是myallmyall2数组的值,其他原理一样,在第二个修改页面显示方法也是一样的做法。

1、             总结

我希望这是一个好的开始,对与实现Web图形界面的进度条可能已经有好的方法了,甚至可以做的很精确,但是我还是自己实现了这个过程,实现了之后至少可以起到解决项目所碰到的问题的作用,不知道该方法是否可以帮你解决问题,或是帮你提出一些思路。如果您有更好的建议欢迎和我联系,我乐意与您共同探讨。

2、             个人简介

李克喜:长期从事J2EE开发和研究,对J2EE系统设计和Rational工具集有深入的研究和应用,特别是RoseRequestPro;熟悉IBM Websphere平台和Oracle数据库;

邮件是:Jem@buildersoft.cnkxli@headsun.netkexi2002@hotmail.com

<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击