输入数字自动生成的饼图
时间:2007-02-18 来源:PHP爱好者
提示:您可以先修改部分代码再运行 <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<TITLE>网页特效|Linkweb.cn/Js|---输入数字自动生成的饼图</TITLE>
<script>
function DrawPieChart()
{
var totalvalue = value1.value/360 + value2.value/360 + value3.value/360 + value4.value/360;
var per1 = value1.value/totalvalue;
var per2 = value2.value/totalvalue;
var per3 = value3.value/totalvalue;
var per4 = value4.value/totalvalue;
var per12 = per1 + per2;
var per123 = per1 + per2 + per3;
Chart.innerHTML = "<OBJECT ID='PieChart' CLASSID='CLSID:369303C2-D7AC-11D0-89D5-00A0C90833E6' STYLE='position:relative;top:0;left:0;width:400;<PARAM NAME='Line0001' ALUE='SetLineColor(255, 0, 127)'><PARAM NAME='Line0002' VALUE='SetFillStyle(1)'><PARAM NAME='Line0003' VALUE='SetFillColor(0, 255, 80)'><PARAM NAME='Line0004' VALUE='Pie(-100, -100, 200, 200, 0, "+ per1 +", 0)'><PARAM NAME='Line0005' VALUE='SetFillStyle(1)'><PARAM NAME='Line0006' VALUE='SetFillColor(0, 0, 255)'><PARAM NAME='Line0007' VALUE='Pie(-100, -100, 200, 200, "+ per1 + ", " + per2 + ", 0)'><PARAM NAME='Line0008' VALUE='SetFillStyle(1)'><PARAM NAME='Line0009' VALUE='SetFillColor(0, 128, 128)'><PARAM NAME='Line0010' VALUE='Pie(-100, -100, 200, 200, "+per12+","+per3+", 0)'><PARAM NAME='Line0011' VALUE='SetFillStyle(1)'><PARAM NAME='Line0012' VALUE='SetFillColor(255, 0, 0)'><PARAM NAME='Line0013' VALUE='Pie(-100, -100, 200, 200, "+per123+","+per4+", 0)'></OBJECT>"
}
</script>
</HEAD>
<BODY>
<table border=1 width=100%>
<tr><td id="Chart" width=50% height=400 align=center>
准备画图。。。</td>
<td width=50%>
<p align=center>
输入4个数<br><input id="value1" type=text size=6 value=0>
<input id="value2" type=text size=6 value=0>
<input id="value3" type=text size=6 value=0>
<input id="value4" type=text size=6 value=0>
</p>
<p align=center>
<input type=button onclick="DrawPieChart()" value="画饼图">
</p>
</td>
</tr>
</table>
</BODY>
</HTML>
提示:您可以先修改部分代码再运行
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<TITLE>网页特效|Linkweb.cn/Js|---输入数字自动生成的饼图</TITLE>
<script>
function DrawPieChart()
{
var totalvalue = value1.value/360 + value2.value/360 + value3.value/360 + value4.value/360;
var per1 = value1.value/totalvalue;
var per2 = value2.value/totalvalue;
var per3 = value3.value/totalvalue;
var per4 = value4.value/totalvalue;
var per12 = per1 + per2;
var per123 = per1 + per2 + per3;
Chart.innerHTML = "<OBJECT ID='PieChart' CLASSID='CLSID:369303C2-D7AC-11D0-89D5-00A0C90833E6' STYLE='position:relative;top:0;left:0;width:400;<PARAM NAME='Line0001' ALUE='SetLineColor(255, 0, 127)'><PARAM NAME='Line0002' VALUE='SetFillStyle(1)'><PARAM NAME='Line0003' VALUE='SetFillColor(0, 255, 80)'><PARAM NAME='Line0004' VALUE='Pie(-100, -100, 200, 200, 0, "+ per1 +", 0)'><PARAM NAME='Line0005' VALUE='SetFillStyle(1)'><PARAM NAME='Line0006' VALUE='SetFillColor(0, 0, 255)'><PARAM NAME='Line0007' VALUE='Pie(-100, -100, 200, 200, "+ per1 + ", " + per2 + ", 0)'><PARAM NAME='Line0008' VALUE='SetFillStyle(1)'><PARAM NAME='Line0009' VALUE='SetFillColor(0, 128, 128)'><PARAM NAME='Line0010' VALUE='Pie(-100, -100, 200, 200, "+per12+","+per3+", 0)'><PARAM NAME='Line0011' VALUE='SetFillStyle(1)'><PARAM NAME='Line0012' VALUE='SetFillColor(255, 0, 0)'><PARAM NAME='Line0013' VALUE='Pie(-100, -100, 200, 200, "+per123+","+per4+", 0)'></OBJECT>"
}
</script>
</HEAD>
<BODY>
<table border=1 width=100%>
<tr><td id="Chart" width=50% height=400 align=center>
准备画图。。。</td>
<td width=50%>
<p align=center>
输入4个数<br><input id="value1" type=text size=6 value=0>
<input id="value2" type=text size=6 value=0>
<input id="value3" type=text size=6 value=0>
<input id="value4" type=text size=6 value=0>
</p>
<p align=center>
<input type=button onclick="DrawPieChart()" value="画饼图">
</p>
</td>
</tr>
</table>
</BODY>
</HTML>
提示:您可以先修改部分代码再运行
相关阅读 更多 +