javascript画图函数库jsgraphics

http://www.walterzorn.com/jsgraphics/jsgraphics_e.htm#docu

一个例子:
 1 < html >< head >
 2
 3 < script  type ="text/javascript"  src ="wz_jsgraphics.js" ></ script >
 4 </ head >
 5 < body  bgcolor ="#ffffff"  onload ="" >
 6 < id ="myCanvas" >   </ p >
 7
 8 ExpandedBlockStart.gifContractedBlock.gif < script  type ="text/javascript" >
 9
10function myDrawFunction()
11ExpandedSubBlockStart.gifContractedSubBlock.gif{
12  jg_doc.setColor("#00ff00"); // green
13  jg_doc.fillEllipse(100200100180); // co-ordinates related to the document
14  jg_doc.setColor("maroon");
15  jg_doc.drawPolyline(new Array(5010120), new Array(105070));
16  jg_doc.paint(); // draws, in this case, directly into the document
17
18  jg.setColor("#ff0000"); // red
19  jg.drawLine(1011322055); // co-ordinates related to "myCanvas"
20  jg.setColor("#0000ff"); // blue
21  jg.fillRect(1101203060);
22  jg.paint();
23
24  jg2.setColor("#0000ff"); // blue
25  jg2.drawEllipse(105030100);
26  jg2.drawRect(4001010050);
27  jg2.paint();
28}

29
30//var jg_doc = new jsGraphics(); // draw directly into document
31var jg_doc = new jsGraphics("myCanvas");
32
33myDrawFunction();
34
35
</ script >  
36
37 </ body ></ html >

它的实现方法是用div实现画点, 其他的都是利用画点画出来的
 1 function _mkDiv(x, y, w, h)
 2 {
 3     this.htm += ' < div  style ="position:absolute;'+
 4         'left:' + x + 'px;'+
 5         'top:' + y + 'px;'+
 6         'width:' + w + 'px;'+
 7         'height:' + h + 'px;'+
 8         'clip:rect(0,'+w+'px,'+h+'px,0);'+
 9         'background-color:' + this.color +
10         (!jg_moz? ';overflow:hidden' : '')+
11         ';" >< \/div > ';
12 }
13
14 function _mkDivIe(x, y, w, h)
15 {
16     this.htm += '%%'+this.color+';'+x+';'+y+';'+w+';'+h+';';
17 }

里面还有一个tooltip库 和 dragdrop库
http://www.walterzorn.com/tooltip/tooltip_e.htm
http://www.walterzorn.com/dragdrop/dragdrop_e.htm
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值