Examples

Examples in the JSXGraph-wiki:

First impressions (the points A,B,C,D,E can be dragged):

Here is the source code for the above construction. It uses the JSXGraph plugin for WordPress.

<pre><jsxgraph width="500" height="500" box="box">
brd = JXG.JSXGraph.initBoard('box',
           {axis:true,originX: 250, originY: 250, unitX: 50, unitY: 25});
brd.suspendUpdate();
var p = [];
p[0] = brd.create('point', [-4,2], {style:6});
p[1] = brd.create('point', [3,-1], {style:6});
addPoint(-2);
addPoint(0.5);
addPoint(1);
var pol = brd.lagrangePolynomial(p);
g = brd.create('functiongraph', [pol, -10, 10], {strokeWidth:3});
g2 = brd.create('functiongraph', [brd.D(pol), -10, 10],
                                      {dash:3, strokeColor:'#ff0000'});

function addPoint(x) {
  p.push(brd.create('point',
              [x,(Math.random()-0.5)*3],{style:6}));
  brd.update();
}
brd.unsuspendUpdate();
</jsxgraph></pre>

9 Comments

  1. wilf
    Posted January 11, 2010 at 11:55 pm | Permalink

    Cool.

  2. Posted January 28, 2010 at 2:49 am | Permalink

    I am a teacher. I would like to create a regular n-sided polygon inscribed inside a circle with radius r. Both r and n should be controlled by sliders. How can this be done?

  3. agentyikes
    Posted February 2, 2010 at 12:41 pm | Permalink

    Thanks very much for your help. The stuffs are so great that I am very much addicted to it.
    I have two more questions.
    1. When I use brd.riemannsum(f,500,type,0,6).toFixed(4) and f = function(x) { return x*x;} with any type (left, right … etc), the result is 72.2160. The accuracy seems not very good. Any way to improve it?
    2. Is there a way to have a slider without the value displayed on its side?
    Thanks again for the cool stuff.

    • Posted February 2, 2010 at 2:14 pm | Permalink

      1) Is it possible that you called
      type = left;
      brd.riemannsum(f,500,type,0,6).toFixed(4)
      instead of
      type = ‘left’;
      brd.riemannsum(f,500,type,0,6).toFixed(4) ?
      i.e. type has to contain a string.
      2) Good request! The next release will enable the attribute “withLabel:false” for sliders, too.

      Thank you very much,
      Alfred

  4. agentyikes
    Posted February 2, 2010 at 3:00 pm | Permalink

    Thanks!
    I did use a string ‘left’ to test and still get the same answer 72.2160.

    • Posted February 2, 2010 at 4:33 pm | Permalink

      The page
      http://jsxgraph.uni-bayreuth.de/wiki/index.php/Riemann_sum_III
      contains your example and it works. Maybe, there is some simple typo in your code.

      • Posted February 2, 2010 at 5:08 pm | Permalink

        I found your (impressive) wiki page.
        The problem is a small typo:
        brd.createElement(‘text’,[-5.5,17,
        function(){ return '`~~` ' +
        (brd.riemannsum(f,n.Value(),ftype(),a,b.Value())).toFixed(4); }]);

        i.e. ftype() instead of ftype.

        • agentyikes
          Posted February 2, 2010 at 11:13 pm | Permalink

          Thanx a lot!

9 Trackbacks

  1. By Angelforge’s Blog » Blog Archive » JSXGraph on March 24, 2009 at 7:25 pm

    [...] JSXGraph » Examples [...]

  2. By 强大的JS画图工具 - JSXGraph - Code Index on April 27, 2009 at 3:56 pm

    [...] Homepage (No Ratings Yet)  Loading … ,1 views addthis_url = ‘http://www.codeindex.cn/9861′; addthis_title = ‘强大的JS画图工具 – JSXGraph’; addthis_pub = ‘grf110′; 相关阅读 (related posts): PHP、AJAX动态布局 — April 27, 2009用Jquery创建类型 Skype-like 的按钮 — April 25, 2009Javascript, Ajax, jQuery工具箱 — April 21, 2009(mb)Gallery 1.0 — April 17, 2009Switch Page Layouts with jQuery & CSS — April 11, 2009jQuery菜单 – jBreadCrumb — April 11, 2009一个轻量级的jQuery lightbox — April 7, 2009Sliding Boxes and Captions with jQuery — April 7, 2009Simple Toggle with CSS & jQuery — April 5, 2009Side Navigation Tooltip / Popup Bubble — April 5, 2009 Tagged with: [ jquery, JSXGraph, SVG, VML ] You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site. [...]

  3. By 20 Fresh JavaScript Data Visualization Libraries on January 17, 2010 at 3:06 pm

    [...] JSXGraph Demo [...]

  4. [...] JSXGraph Demo [...]

  5. [...] JSXGraph Demo [...]

  6. [...] JSXGraph Demo [...]

  7. [...] JSXGraph Demo [...]

  8. [...] Link Live Examples Download [...]

  9. [...] Link Live Examples Download [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>