zoukankan      html  css  js  c++  java
  • 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<script type="text/javascript">
     9
    10function myDrawFunction()
    11{
    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实现画点, 其他的都是利用画点画出来的
     1function _mkDiv(x, y, w, h)
     2{
     3    this.htm += '<div style="position:absolute;'+
     4        'left:' + x + 'px;'+
     5        'top:' + y + 'px;'+
     6        '' + 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
    14function _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
  • 相关阅读:
    2013第五周上机任务【项目1 三角形类(构造函数)】
    Google搜索小技巧
    项目总结:文件上传(MVC uploadify)
    Oracle 触发器 Update 不能操作本表的疑问
    【笔试题STL】求两个vector的交集
    Zookeeper(六)数据模型
    是的,我们真的在遭遇有史以来最大的DDoS攻击,并且还在加剧
    在MFC框架下使用osg报内存泄露的解决办法
    NetBeans 时事通讯(刊号 # 107 Jun 25, 2010)
    VS 2008中的C/C++静态代码分析工具Prefast
  • 原文地址:https://www.cnblogs.com/cutepig/p/1540723.html
Copyright © 2011-2022 走看看