我用了jpgraph 听说是php里一个不错的曲线图的类 可是,执行后却出这个 JpGraph Error This PHP installation is not configured with the GD library. Please recompile PHP with GD support to run JpGraph. (Neither function imagetypes() nor imagecreatefromstring() does exist)高手能帮帮忙吗
我再试试 请问怎么能支持GD 是在安装php的时候要装吗
是的,安装php时要将GD库打包一并安装
<script language="JavaScript"> IE4 = ! (navigator.appVersion.charAt(0) < "4" || navigator.appName == "Netscape") var xo=0 var yo=0 var Ox = -1 var Oy = -1 var rad = Math.PI/180 var maxY = 120 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=0 var 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-dx for(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 biaozhuStr(x,y,s) { return '<span style="position:absolute;font-size:9pt;left:'+x+';top:'+orgY(y)+';">'+s+'</span>' } function biaozhu(x,y,s,t) { var ox = xo var oy = yo var oColor = color 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>----------- 以上是JS画曲线图函数,以下是调用 <script> color = "#0000FF" //颜色 var jd = new Array( 4,7,11,6,2 //数据 ) MoveTo(0,jd[0]*(-140/10)+113) biaozhu(xo,yo,jd[0]) for(i=1;i<jd.length;i++) { LineTo(i*30+0,jd[i]*(-140/10)+113) biaozhu(xo,yo,jd[i],1) }
JpGraph Error This PHP installation is not configured with the GD library. Please recompile PHP with GD support to run JpGraph. (Neither function imagetypes() nor imagecreatefromstring() does exist)高手能帮帮忙吗
IE4 = ! (navigator.appVersion.charAt(0) < "4" || navigator.appName == "Netscape")
var xo=0
var yo=0
var Ox = -1
var Oy = -1
var rad = Math.PI/180
var maxY = 120
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=0
var 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-dx
for(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 biaozhuStr(x,y,s) {
return '<span style="position:absolute;font-size:9pt;left:'+x+';top:'+orgY(y)+';">'+s+'</span>'
}
function biaozhu(x,y,s,t) {
var ox = xo
var oy = yo
var oColor = color
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>-----------
以上是JS画曲线图函数,以下是调用
<script>
color = "#0000FF" //颜色
var jd = new Array(
4,7,11,6,2 //数据
)
MoveTo(0,jd[0]*(-140/10)+113)
biaozhu(xo,yo,jd[0])
for(i=1;i<jd.length;i++) {
LineTo(i*30+0,jd[i]*(-140/10)+113)
biaozhu(xo,yo,jd[i],1)
}
vml特别简单
10分钟就可以学会生成曲线
官方提供的例子也很多,有技术保证