一段正向及横向的统计图表

<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>
<SCRIPT LANGUAGE="javascript">

<!-- Hide javascript from Java-Impaired Browsers

function getHplot(){

n=new initArray(0,0,0,0,0,0)

v=new initArray(0,0,0,0,0,0)

title=document.isnform.title.value;

stitle=document.isnform.stitle.value;

document.write('<TABLE BORDER=0 WIDTH=486><TR><TD '

+'COLSPAN=3 ALIGN=CENTER><B>Horizontal Bar Graph</'

+'B></TD></TR><TR><TD COLSPAN=3 ALIGN=CENTER><B>'

+title+'</B><BR><I>'+stitle+'</I></TD></TR>');

v[0]=document.isnform.v1.value;

v[1]=document.isnform.v2.value;

v[2]=document.isnform.v3.value;

v[3]=document.isnform.v4.value;

v[4]=document.isnform.v5.value;

v[5]=document.isnform.v6.value;

n[9]=0;

n[6]=0;

n[7]=0;

for (var i=0;i<6;i++){

if (v[i].length>n[9]){

n[9]=v[i].length;

}

/* The next three lines are needed for visitors who

still live on the Win3.x platform. If none of your

visitors use older platforms,

n[i]=eval(v[i]);

may be substituted for these three lines. */

str=v[i]

StringToNumber();

n[i]=num; // eval(v[i]); may be substituted

if (n[i]<0){

n[i]=0;

}

n[6]+=n[i];

if (n[i]>n[7]){

n[7]=n[i];

}

}

n[10]=(n[9]+6)*8

n[8]=n[7]/(484-n[10]); // my divisor

document.write('<TR><TD><B>'+document.isnform.n1.value

+'</B></TD><TD><IMG SRC="a.gif" HEIGHT=10 WIDTH='

+(n[0]/n[8])+' BORDER=1></TD><TD>'+v[0]+'</TD></TR>'

+'<TR><TD><B>'+document.isnform.n2.value

+'</B></TD><TD><IMG SRC="b.gif" HEIGHT=10 WIDTH='+(n[1]/n[8])

+' BORDER=1></TD><TD>'+v[1]+'</TD></TR>'

+'<TR><TD><B>'+document.isnform.n3.value

+'</B></TD><TD><IMG SRC="c.gif" HEIGHT=10 WIDTH='+(n[2]/n[8])

+' BORDER=1></TD><TD>'+v[2]+'</TD></TR>'

+'<TR><TD><B>'+document.isnform.n4.value

+'</B></TD><TD><IMG SRC="d.gif" HEIGHT=10 WIDTH='+(n[3]/n[8])

+' BORDER=1></TD><TD>'+v[3]+'</TD></TR>'

+'<TR><TD><B>'+document.isnform.n5.value

+'</B></TD><TD><IMG SRC="e.gif" HEIGHT=10 WIDTH='+(n[4]/n[8])

+' BORDER=1></TD><TD>'+v[4]+'</TD></TR>'

+'<TR><TD><B>'+document.isnform.n6.value

+'</B></TD><TD><IMG SRC="a.gif" HEIGHT=10 WIDTH='+(n[5]/n[8])

+' BORDER=1></TD><TD>'+v[5]+'</TD></TR>');

document.write('<TR><TD COLSPAN=3><HR NOSHADE></TD></TR></TABLE>');

getVplot();

}

function getVplot(){

n[8]=n[7]/100;

document.write('<P><TABLE BORDER=0 WIDTH=486><TR><TD'

+' COLSPAN=6 ALIGN=CENTER><B>Vertical Bar Graph</B></TD></TR>'

+'<TR><TD COLSPAN=6 ALIGN=CENTER><B>'

+title+'</B><BR><I>'+stitle+'</I></TD></TR><TR>'

+'<TD VALIGN=BOTTOM ALIGN=CENTER><IMG SRC="a.gif" HEIGHT='

+(n[0]/n[8])

+' WIDTH=50 BORDER=1></TD>'

+'<TD VALIGN=BOTTOM ALIGN=CENTER><IMG SRC="b.gif" HEIGHT='

+(n[1]/n[8])+' WIDTH=50 BORDER=1></TD>'

+'<TD VALIGN=BOTTOM ALIGN=CENTER><IMG SRC="c.gif" HEIGHT='

+(n[2]/n[8])+' WIDTH=50 BORDER=1></TD>'

+'<TD VALIGN=BOTTOM ALIGN=CENTER><IMG SRC="d.gif" HEIGHT='

+(n[3]/n[8])+' WIDTH=50 BORDER=1></TD>'

+'<TD VALIGN=BOTTOM ALIGN=CENTER><IMG SRC="e.gif" HEIGHT='

+(n[4]/n[8])+' WIDTH=50 BORDER=1></TD>'

+'<TD VALIGN=BOTTOM ALIGN=CENTER><IMG SRC="a.gif" HEIGHT='

+(n[5]/n[8])+' WIDTH=50 BORDER=1></TD></TR><TR>'

+'<TD ALIGN=CENTER><B>'+document.isnform.n1.value+'</B></TD>'

+'<TD ALIGN=CENTER><B>'+document.isnform.n2.value+'</B></TD>'

+'<TD ALIGN=CENTER><B>'+document.isnform.n3.value+'</B></TD>'

+'<TD ALIGN=CENTER><B>'+document.isnform.n4.value+'</B></TD>'

+'<TD ALIGN=CENTER><B>'+document.isnform.n5.value+'</B></TD>'

+'<TD ALIGN=CENTER><B>'+document.isnform.n6.value+'</B></TD></TR>'

+'<TR><TD ALIGN=CENTER>'+v[0]+'</B></TD>'

+'<TD ALIGN=CENTER>'+v[1]+'</TD>'

+'<TD ALIGN=CENTER>'+v[2]+'</TD>'

+'<TD ALIGN=CENTER>'+v[3]+'</TD>'

+'<TD ALIGN=CENTER>'+v[4]+'</TD>'

+'<TD ALIGN=CENTER>'+v[5]+'</TD></TR><TR><TD COLSPAN=6'

+'><HR NOSHADE><P></TD></TR></TABLE>');

}

var pwr=new initArray(1,2,3,4);

pwr[0]=1;

pwr[1]=10;

pwr[2]=100;

pwr[3]=1000;

pwr[4]=10000;

pwr[5]=100000;

pwr[6]=1000000;

pwr[7]=10000000;

/* Add more to array - pwr[8]=100000000, etc. -

if strings longer than 8 are to be used. */

var ns="0123456789"

var cr="";

var str="";

/* Pass this function a string (named "str") and it will

return a number (named "num") Useful until all versions

of javascript on all platforms support string to numeric

conversions with predictability. */

function StringToNumber(){

num=0;

strl=str.length;

for (var j=strl-1;j>-1;j--){

cr=str.substring(j,j+1);

pos=ns.indexOf(cr);

num+=pos*pwr[strl-j-1];

}

}

function initArray() {

this.length=initArray.arguments.length;

for (var i=0;i<this.length;i++) {

this[i]=initArray.arguments[i];

}

}

// End Hiding -->

</SCRIPT>

<CENTER>

<FORM NAME='isnform'>

<TABLE BORDER=0 WIDTH=486>

<TR><TD ALIGN=CENTER COLSPAN=7>Graph Title: <INPUT TYPE='text' NAME='title' SIZE='40' value='Visitors every week since the start!'>

<BR>Graph Legend: <INPUT TYPE='text' NAME='stitle' SIZE='40' value='(29 june - 31 july)'></TD></TR>

<TR><TD>Graph value Names:</TD>

<TD><INPUT TYPE='text' NAME='n1' SIZE='8' value='29/6-6/7'></TD>

<TD><INPUT TYPE='text' NAME='n2' SIZE='8' value='6/7-13/7'></TD>

<TD><INPUT TYPE='text' NAME='n3' SIZE='8' value='13/7-20/7'></TD>

<TD><INPUT TYPE='text' NAME='n4' SIZE='8' value='20/7-27/7'></TD>

<TD><INPUT TYPE='text' NAME='n5' SIZE='8' value='27/7-31/7'></TD>

<TD><INPUT TYPE='text' NAME='n6' SIZE='8' value='29/6-31/7'></TD></TR>

<TR><TD><BR>Graph values:

<TD><INPUT TYPE='text' NAME='v1' SIZE='8' value=441>

<TD><INPUT TYPE='text' NAME='v2' SIZE='8' value=841>

<TD><INPUT TYPE='text' NAME='v3' SIZE='8' value=1233>

<TD><INPUT TYPE='text' NAME='v4' SIZE='8' value=1547>

<TD><INPUT TYPE='text' NAME='v5' SIZE='8' value=777>

<TD><INPUT TYPE='text' NAME='v6' SIZE='8' value=488>

</TD></TR>

</TABLE>

</FORM>

<SCRIPT LANGUAGE="javascript">

<!-- Hide from javascript-Impaired Browsers

getHplot();

// End Hiding -->

</SCRIPT>

</CENTER>

<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>
阅读更多
个人分类: javascript
上一篇How to setup a basic Struts project using Eclipse IDE
下一篇在NetBeans平台上开发J2ME游戏实例讲解(第二部分)
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭