用绘图指令我为什么不能输出文本? 别关这个了,我给你一个好的:http://developer.netscape.com/docs/technote/javascript/graph/#contents 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 sorry,看错了,给了个直方图的看下面的“<html><head><title>JavaScript绘图</title><script language="JavaScript">IE4 = ! (navigator.appVersion.charAt(0) < "4" || navigator.appName == "Netscape")var xo=0var yo=0var Ox = -1var Oy = -1var rad = Math.PI/180var maxY = 400var color = "red"function print(str) {document.write(str)}function orgY(y) {return maxY-y}function outPlot(x,y,w,h) {print('<span style="position:absolute;left:'+x+';top:'+y+';height:'+h+';width:'+w+';font-size:1px;background-color:'+color+'"></span>')}function Plot(x,y) {outPlot(x,y,1,1)if(Ox>=0 || Oy>=0) {ShowLine(Ox,Oy,x-Ox,y-Oy)}Ox = xOy = y}function ShowLine(x,y,w,h) {if(w<0) {x += ww = Math.abs(w)}if(h<0) {y += hh = Math.abs(h)}if(w<1) w=1if(h<1) h=1outPlot(x,y,Math.round(w),Math.round(h))}function LineTo(x,y) {Line(xo,yo,x,y)}function sign(n) {if(n>0)return 1if(n<0)return -1return n}function Line(x1,y1,x2,y2) {x2 = Math.round(x2)y2 = Math.round(y2)xo = x2yo = y2y1 = orgY(y1)y2 = orgY(y2)var str = ""var i=0var x = x1var y = y1dx = Math.abs(x2-x1)dy = Math.abs(y2-y1)s1 = sign(x2-x1)s2 = sign(y2-y1)if(dx==0 || dy==0) {ShowLine(x1,y1,x2-x1,y2-y1)return}if(dx>dy) {temp = dxdx = dydy = tempkey = 1}elsekey = 0e = 2*dy-dxfor(i=0;i<dx;i++) {px = 0py = 0Plot(x,y)while(e>=0) {if(key==1) {x += s1px += s1}else {y += s2py += s2}e = e-2*dx}if(key==1)y += s2elsex += s1e = e+2*dy}} function MoveTo(x,y) {Ox = Oy = -1xo = Math.round(x)yo = Math.round(y)}// 圆function Cir(x,y,r) {MoveTo(x+r,y)for(i=0;i<=360;i+=5) {LineTo(r*Math.cos(i*rad)+x,r*Math.sin(i*rad)+y)}}// 弧形function Arc(x,y,r,a1,a2) {MoveTo(r*Math.cos(a1*rad)+x,r*Math.sin(a1*rad)+y)for(i=a1;i<=a2;i++) {LineTo(r*Math.cos(i*rad)+x,r*Math.sin(i*rad)+y)}}// 扇形function Pei(x,y,r,a1,a2) {MoveTo(x,y)for(var i=a1;i<=a2;i++) {LineTo(r*Math.cos(i*rad)+x,r*Math.sin(i*rad)+y)}LineTo(x,y)}// 弹出扇形function PopPei(x,y,r,a1,a2) {dx = r*Math.cos((a1+(a2-a1)/2)*rad)/10dy = r*Math.sin((a1+(a2-a1)/2)*rad)/10x += dxy += dyMoveTo(x,y)for(var i=a1;i<=a2;i++) {LineTo(r*Math.cos(i*rad)+x,r*Math.sin(i*rad)+y)}LineTo(x,y)}// 矩形function Rect(x,y,w,h) {MoveTo(x,y)LineTo(x+w,y)LineTo(x+w,y+h)LineTo(x,y+h)LineTo(x,y)}// 准星function zhunxing(x,y) {var ox = xovar oy = yovar oColor = colorcolor = "#000000"Line(x-5,y,x+6,y)Line(x,y-6,x,y+5)print('<span style="position:absolute;font-size:10pt;left:'+(x+5)+';top:'+orgY(y+5)+';">['+x+','+y+']</span>')color = oColorxo = oxyo = oy}// 标注function biaozhuStr(x,y,s) {return '<span style="position:absolute;font-size:10pt;left:'+x+';top:'+orgY(y)+';">'+s+'</span>'}function biaozhu(x,y,s,t) {var ox = xovar oy = yovar oColor = colorpoint = "p01.gif"if(t==1) {print(biaozhuStr(x-5,y+6,"·"+s))}if(t==2) {print(biaozhuStr(xo+x*Math.cos(y*rad)-10,yo+x*Math.sin(y*rad),s))}color = oColorxo = oxyo = oy}</script></head><body><table border="0" width="100%"><tr><td width="100%" style="font-family: 方正舒体; font-size: 18pt; color: #FF0000" class="t1">JavaScript绘图</td></tr><tr><td width="100%" style="font-family: 幼圆; font-size: 12pt; color: #008000" class="t2"> 如果需要在网页上提供图形化的资料,通常是将其制作成图片,但这样一来网络上的开销就太大了。有什么办法呢?这里向你提供一组JavaScript函数,来解决这一问题。虽然简单了点,但是对画点线图来说还是绰绰有余的!</td></tr></table><script>if(IE4) {// 基本图形color = "maroon"Cir(50,40,20)Arc(100,40,20,60,120)Pei(150,60,40,240,300)Rect(200,20,40,40)Line(0,0,20,20)// 折线图color = "#FF0000"var jd = new Array(203,232,277,223,271,234,273,284,276,250,267,280)MoveTo(30,jd[0]-40)biaozhu(xo,yo,jd[0])for(i=1;i<jd.length;i++) {LineTo(i*30+30,jd[i]-40)biaozhu(xo,yo,jd[i],1)}color = "#C0C0C0"Line(30,140,i*30+30,140)Line(30,140,30,260)// 饼图color = "#00FF00"var gc = new Array(150,120,200,180,180)var s = 0var m = 0var n = 0for(i=0;i<gc.length;i++) {s +=gc[i]if(gc[i] > m) {m = gc[i]n = i}}var k = s/360var mm = 0var a =0for(i=0;i<gc.length;i++) {b = Math.round((gc[i]+mm)/k)if(i==n)PopPei(600,150,100,a,b)elsePei(600,150,100,a,b)biaozhu(60,a+(b-a)/2,Math.round(gc[i]/s*100)+"%",2)mm = mm+gc[i]a = b}// 十字标注MoveTo(280,20)zhunxing(xo,yo)}else {document.write("<p> </p><table bgcolor=#FF0000><tr><td><font color=#FFFF00>对不起!您的浏览器不能支持该页的某些功能,请换用IE4.0以上版本的浏览器!谢谢!</font></td></tr></table>")}</script></body></html> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><TITLE> New Document </TITLE><META NAME="Generator" CONTENT="EditPlus"><META NAME="Author" CONTENT=""><META NAME="Keywords" CONTENT=""><META NAME="Description" CONTENT=""></HEAD><BODY><SCRIPT LANGUAGE="JavaScript"><!--HTML = "<OBJECT ID='PieChart' CLASSID='CLSID:369303C2-D7AC-11D0-89D5-00A0C90833E6'STYLE='position:relative;top:0;left:0;width:400;height:400'>"document.write(HTML)//--></SCRIPT> <PARAM NAME='Line0001' VALUE='SetLineColor(200, 200,200)'><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='Rect(120 ,0, 15, 15, 0)'><PARAM NAME='Line0006' VALUE='SetFillStyle(1)'><PARAM NAME='Line0007' VALUE='SetFillColor(0, 0, 255)'><PARAM NAME='Line0008' VALUE='Rect(120 ,19, 15, 15, 0)'><PARAM NAME='Line0009' VALUE='Pie(-100, -100, 200, 200, "+ per1 + ", " + per2 + ", 0)'><PARAM NAME='Line0010' VALUE='SetFillStyle(1)'><PARAM NAME='Line0011' VALUE='SetFillColor(0, 128, 128)'><PARAM NAME='Line0012' VALUE='Pie(-100, -100, 200, 200, "+per12+","+per3+", 0)'><PARAM NAME='Line0013' VALUE='Rect(120 ,38, 15, 15, 0)'><PARAM NAME='Line0014' VALUE='SetFillStyle(1)'><PARAM NAME='Line0015' VALUE='SetFillColor(255, 0, 0)'><PARAM NAME='Line0016' VALUE='Pie(-100, -100, 200, 200, "+per123+","+per4+", 0)'><PARAM NAME='Line0017' VALUE='Rect(120 ,57, 15, 15, 0)'><PARAM NAME='Line0018' VALUE='SetFont('ARIAL',15,15,0,0,0)'> /*设置字体*/<PARAM NAME='Line0019' VALUE='Text('码流A',120,-20,0)'></OBJECT>" /*输出文本*/</BODY></HTML>=====================zhangguagua(瓜瓜) 这种动动好用么?楼住的用得没错, 应该死TextOut才规范,使用下面的也可以 ==========================<OBJECT ID="chtTest" WIDTH=248 HEIGHT=192 CLASSID="CLSID:FC25B780-75BE-11CF-8B01-444553540000"> <PARAM NAME="_ExtentX" VALUE="6562"> <PARAM NAME="_ExtentY" VALUE="5080"> <PARAM NAME="Rows" VALUE="4"> <PARAM NAME="Columns" VALUE="3"> <PARAM NAME="ChartType" VALUE="1"> <PARAM NAME="Data[0][0]" VALUE="9"> <PARAM NAME="Data[0][1]" VALUE="10"> <PARAM NAME="Data[0][2]" VALUE="11"> <PARAM NAME="Data[1][0]" VALUE="7"> <PARAM NAME="Data[1][1]" VALUE="11"> <PARAM NAME="Data[1][2]" VALUE="12"> <PARAM NAME="Data[2][0]" VALUE="6"> <PARAM NAME="Data[2][1]" VALUE="12"> <PARAM NAME="Data[2][2]" VALUE="13"> <PARAM NAME="Data[3][0]" VALUE="11"> <PARAM NAME="Data[3][1]" VALUE="13"> <PARAM NAME="Data[3][2]" VALUE="14"> <PARAM NAME="HorizontalAxis" VALUE="0"> <PARAM NAME="VerticalAxis" VALUE="0"> <PARAM NAME="hgridStyle" VALUE="0"> <PARAM NAME="vgridStyle" VALUE="0"> <PARAM NAME="ColorScheme" VALUE="0"> <PARAM NAME="BackStyle" VALUE="1"> <PARAM NAME="Scale" VALUE="100"> <PARAM NAME="DisplayLegend" VALUE="0"> <PARAM NAME="BackColor" VALUE="16777215"> <PARAM NAME="ForeColor" VALUE="32768"></OBJECT> To: llrock(百乐宝||昨夜星辰) 我刚接触这个东东,你能告诉我这个的格式或者语法规则吗?或者给我提供一些参考资料,让我学习可以吗?谢谢:) google map js验证问题 !!!!!!! 有人用过ESTjs中的grid吗?想请教个问题! 关于日历插件 有关列求和的一点问题 怎样把有链接的文字,通过点击,自动加入到文本框中去? 请问js只能用//来注释吗? 文本型如何转换成数字型? e is undefined 如何用jquery 控制子div下的孙子div的样式 javascript高级应用:能不能通过字符串名来调用相应的函数 请JS高手帮我看看什么问题!急
<html>
<head>
<title>JavaScript绘图</title>
<script language="JavaScript">
IE4 = ! (navigator.appVersion.charAt(0) < "4" || navigator.appName == "Netscape")var xo=0
var yo=0
var Ox = -1
var Oy = -1var rad = Math.PI/180
var maxY = 400
var color = "red"function print(str) {
document.write(str)
}function orgY(y) {
return maxY-y
}
function outPlot(x,y,w,h) {
print('<span style="position:absolute;left:'+x+';top:'+y+';height:'+h+';width:'+w+';font-size:1px;background-color:'+color+'"></span>')
}function Plot(x,y) {
outPlot(x,y,1,1)
if(Ox>=0 || Oy>=0) {
ShowLine(Ox,Oy,x-Ox,y-Oy)
}
Ox = x
Oy = y
}function ShowLine(x,y,w,h) {
if(w<0) {
x += w
w = Math.abs(w)
}
if(h<0) {
y += h
h = Math.abs(h)
}
if(w<1) w=1
if(h<1) h=1
outPlot(x,y,Math.round(w),Math.round(h))
}function LineTo(x,y) {
Line(xo,yo,x,y)
}function sign(n) {
if(n>0)
return 1
if(n<0)
return -1
return n
}function Line(x1,y1,x2,y2) {
x2 = Math.round(x2)
y2 = Math.round(y2)
xo = x2
yo = y2
y1 = orgY(y1)
y2 = orgY(y2)
var str = ""
var i=0var x = x1
var y = y1
dx = Math.abs(x2-x1)
dy = Math.abs(y2-y1)
s1 = sign(x2-x1)
s2 = sign(y2-y1)if(dx==0 || dy==0) {
ShowLine(x1,y1,x2-x1,y2-y1)
return
}if(dx>dy) {
temp = dx
dx = dy
dy = temp
key = 1
}else
key = 0
e = 2*dy-dxfor(i=0;i<dx;i++) {
px = 0
py = 0
Plot(x,y)
while(e>=0) {
if(key==1) {
x += s1
px += s1
}else {
y += s2
py += s2
}
e = e-2*dx
}
if(key==1)
y += s2
else
x += s1
e = e+2*dy
}
} function MoveTo(x,y) {
Ox = Oy = -1
xo = Math.round(x)
yo = Math.round(y)
}// 圆
function Cir(x,y,r) {
MoveTo(x+r,y)
for(i=0;i<=360;i+=5) {
LineTo(r*Math.cos(i*rad)+x,r*Math.sin(i*rad)+y)
}
}
// 弧形
function Arc(x,y,r,a1,a2) {
MoveTo(r*Math.cos(a1*rad)+x,r*Math.sin(a1*rad)+y)
for(i=a1;i<=a2;i++) {
LineTo(r*Math.cos(i*rad)+x,r*Math.sin(i*rad)+y)
}
}
// 扇形
function Pei(x,y,r,a1,a2) {
MoveTo(x,y)
for(var i=a1;i<=a2;i++) {
LineTo(r*Math.cos(i*rad)+x,r*Math.sin(i*rad)+y)
}
LineTo(x,y)
}
// 弹出扇形
function PopPei(x,y,r,a1,a2) {
dx = r*Math.cos((a1+(a2-a1)/2)*rad)/10
dy = r*Math.sin((a1+(a2-a1)/2)*rad)/10
x += dx
y += dy
MoveTo(x,y)
for(var i=a1;i<=a2;i++) {
LineTo(r*Math.cos(i*rad)+x,r*Math.sin(i*rad)+y)
}
LineTo(x,y)
}// 矩形
function Rect(x,y,w,h) {
MoveTo(x,y)
LineTo(x+w,y)
LineTo(x+w,y+h)
LineTo(x,y+h)
LineTo(x,y)
}// 准星
function zhunxing(x,y) {
var ox = xo
var oy = yo
var oColor = color
color = "#000000"
Line(x-5,y,x+6,y)
Line(x,y-6,x,y+5)
print('<span style="position:absolute;font-size:10pt;left:'+(x+5)+';top:'+orgY(y+5)+';">['+x+','+y+']</span>')
color = oColor
xo = ox
yo = oy
}
// 标注
function biaozhuStr(x,y,s) {
return '<span style="position:absolute;font-size:10pt;left:'+x+';top:'+orgY(y)+';">'+s+'</span>'
}
function biaozhu(x,y,s,t) {
var ox = xo
var oy = yo
var oColor = color
point = "p01.gif"
if(t==1) {
print(biaozhuStr(x-5,y+6,"·"+s))
}
if(t==2) {
print(biaozhuStr(xo+x*Math.cos(y*rad)-10,yo+x*Math.sin(y*rad),s))
}
color = oColor
xo = ox
yo = oy
}
</script>
</head><body>
<table border="0" width="100%">
<tr>
<td width="100%" style="font-family: 方正舒体; font-size: 18pt; color: #FF0000" class="t1">JavaScript绘图</td>
</tr>
<tr>
<td width="100%" style="font-family: 幼圆; font-size: 12pt; color: #008000" class="t2">
如果需要在网页上提供图形化的资料,通常是将其制作成图片,但这样一来网络上的开销就太大了。有什么办法呢?这里向你提供一组JavaScript函数,来解决这一问题。虽然简单了点,但是对画点线图来说还是绰绰有余的!</td>
</tr>
</table><script>
if(IE4) {// 基本图形
color = "maroon"
Cir(50,40,20)
Arc(100,40,20,60,120)
Pei(150,60,40,240,300)
Rect(200,20,40,40)
Line(0,0,20,20)
// 折线图
color = "#FF0000"
var jd = new Array(
203,232,277,223,271,234,273,284,276,250,267,280
)
MoveTo(30,jd[0]-40)
biaozhu(xo,yo,jd[0])
for(i=1;i<jd.length;i++) {
LineTo(i*30+30,jd[i]-40)
biaozhu(xo,yo,jd[i],1)
}
color = "#C0C0C0"
Line(30,140,i*30+30,140)
Line(30,140,30,260)// 饼图
color = "#00FF00"
var gc = new Array(
150,120,200,180,180
)
var s = 0
var m = 0
var n = 0
for(i=0;i<gc.length;i++) {
s +=gc[i]
if(gc[i] > m) {
m = gc[i]
n = i
}
}
var k = s/360
var mm = 0
var a =0
for(i=0;i<gc.length;i++) {
b = Math.round((gc[i]+mm)/k)
if(i==n)
PopPei(600,150,100,a,b)
else
Pei(600,150,100,a,b)
biaozhu(60,a+(b-a)/2,Math.round(gc[i]/s*100)+"%",2)
mm = mm+gc[i]
a = b
}// 十字标注
MoveTo(280,20)
zhunxing(xo,yo)}else {
document.write("<p> </p><table bgcolor=#FF0000><tr><td><font color=#FFFF00>对不起!您的浏览器不能支持该页的某些功能,请换用IE4.0以上版本的浏览器!谢谢!</font></td></tr></table>")
}
</script></body>
</html>
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD><BODY>
<SCRIPT LANGUAGE="JavaScript">
<!--
HTML = "<OBJECT ID='PieChart' CLASSID='CLSID:369303C2-D7AC-11D0-89D5-00A0C90833E6'STYLE='position:relative;top:0;left:0;width:400;height:400'>"
document.write(HTML)
//-->
</SCRIPT>
<PARAM NAME='Line0001' VALUE='SetLineColor(200, 200,200)'>
<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='Rect(120 ,0, 15, 15, 0)'>
<PARAM NAME='Line0006' VALUE='SetFillStyle(1)'>
<PARAM NAME='Line0007' VALUE='SetFillColor(0, 0, 255)'>
<PARAM NAME='Line0008' VALUE='Rect(120 ,19, 15, 15, 0)'>
<PARAM NAME='Line0009' VALUE='Pie(-100, -100, 200, 200, "+ per1 + ", " + per2 + ", 0)'>
<PARAM NAME='Line0010' VALUE='SetFillStyle(1)'>
<PARAM NAME='Line0011' VALUE='SetFillColor(0, 128, 128)'>
<PARAM NAME='Line0012' VALUE='Pie(-100, -100, 200, 200, "+per12+","+per3+", 0)'>
<PARAM NAME='Line0013' VALUE='Rect(120 ,38, 15, 15, 0)'>
<PARAM NAME='Line0014' VALUE='SetFillStyle(1)'>
<PARAM NAME='Line0015' VALUE='SetFillColor(255, 0, 0)'>
<PARAM NAME='Line0016' VALUE='Pie(-100, -100, 200, 200, "+per123+","+per4+", 0)'>
<PARAM NAME='Line0017' VALUE='Rect(120 ,57, 15, 15, 0)'>
<PARAM NAME='Line0018' VALUE='SetFont('ARIAL',15,15,0,0,0)'> /*设置字体*/
<PARAM NAME='Line0019' VALUE='Text('码流A',120,-20,0)'></OBJECT>" /*输出文本*/</BODY>
</HTML>
=====================
zhangguagua(瓜瓜)
这种动动好用么?
楼住的用得没错,
使用下面的也可以
==========================
<OBJECT ID="chtTest" WIDTH=248 HEIGHT=192
CLASSID="CLSID:FC25B780-75BE-11CF-8B01-444553540000">
<PARAM NAME="_ExtentX" VALUE="6562">
<PARAM NAME="_ExtentY" VALUE="5080">
<PARAM NAME="Rows" VALUE="4">
<PARAM NAME="Columns" VALUE="3">
<PARAM NAME="ChartType" VALUE="1">
<PARAM NAME="Data[0][0]" VALUE="9">
<PARAM NAME="Data[0][1]" VALUE="10">
<PARAM NAME="Data[0][2]" VALUE="11">
<PARAM NAME="Data[1][0]" VALUE="7">
<PARAM NAME="Data[1][1]" VALUE="11">
<PARAM NAME="Data[1][2]" VALUE="12">
<PARAM NAME="Data[2][0]" VALUE="6">
<PARAM NAME="Data[2][1]" VALUE="12">
<PARAM NAME="Data[2][2]" VALUE="13">
<PARAM NAME="Data[3][0]" VALUE="11">
<PARAM NAME="Data[3][1]" VALUE="13">
<PARAM NAME="Data[3][2]" VALUE="14">
<PARAM NAME="HorizontalAxis" VALUE="0">
<PARAM NAME="VerticalAxis" VALUE="0">
<PARAM NAME="hgridStyle" VALUE="0">
<PARAM NAME="vgridStyle" VALUE="0">
<PARAM NAME="ColorScheme" VALUE="0">
<PARAM NAME="BackStyle" VALUE="1">
<PARAM NAME="Scale" VALUE="100">
<PARAM NAME="DisplayLegend" VALUE="0">
<PARAM NAME="BackColor" VALUE="16777215">
<PARAM NAME="ForeColor" VALUE="32768">
</OBJECT>
我刚接触这个东东,你能告诉我这个的格式或者语法规则吗?或者给我提供一些参考资料,让我学习可以吗?谢谢:)