Parametric curve plotter: Difference between revisions
From JSXGraph Wiki
| A WASSERMANN (talk | contribs) No edit summary | No edit summary | ||
| Line 25: | Line 25: | ||
| function clearAll() {   | function clearAll() {   | ||
|    JXG.JSXGraph.freeBoard(board); |    JXG.JSXGraph.freeBoard(board); | ||
|    board = JXG.JSXGraph.initBoard('jxgbox', {axis:true,  |    board = JXG.JSXGraph.initBoard('jxgbox', {axis:true, boundingbox: [-5, 5, 5, -5]}); | ||
|    a = board.createElement('slider', [[0,-1],[3,-1],[-4*Math.PI,0,0]], {style:6, name:'a'}); |    a = board.createElement('slider', [[0,-1],[3,-1],[-4*Math.PI,0,0]], {style:6, name:'a'}); | ||
|    b = board.createElement('slider', [[0,-2],[3,-2],[0,1,4*Math.PI]], {style:6, name:'b'}); |    b = board.createElement('slider', [[0,-2],[3,-2],[0,1,4*Math.PI]], {style:6, name:'b'}); | ||
| Line 52: | Line 52: | ||
| function clearAll() {   | function clearAll() {   | ||
|    JXG.JSXGraph.freeBoard(board); |    JXG.JSXGraph.freeBoard(board); | ||
|    board = JXG.JSXGraph.initBoard('jxgbox', {axis:true,  |    board = JXG.JSXGraph.initBoard('jxgbox', {axis:true, boundingbox: [-5, 5, 5, -5]}); | ||
|    a = board.createElement('slider', [[0,-1],[3,-1],[-4*Math.PI,0,0]], {style:6, name:'a'}); |    a = board.createElement('slider', [[0,-1],[3,-1],[-4*Math.PI,0,0]], {style:6, name:'a'}); | ||
|    b = board.createElement('slider', [[0,-2],[3,-2],[0,1,4*Math.PI]], {style:6, name:'b'}); |    b = board.createElement('slider', [[0,-2],[3,-2],[0,1,4*Math.PI]], {style:6, name:'b'}); | ||
Revision as of 11:23, 31 January 2013
  
  
  
The JavaScript code
board = JXG.JSXGraph.initBoard('jxgbox', {axis:true, boundingbox:[-5,5,5,-5]});
a = board.createElement('slider', [[0,-1],[3,-1],[-4*Math.PI,0,0]], {style:6, name:'a'});
b = board.createElement('slider', [[0,-2],[3,-2],[0,1,4*Math.PI]], {style:6, name:'b'});
function plot(){
  eval(document.getElementById("eingabe").value);
  graph = board.createElement('curve', [
            x,y, 
            function(){return a.Value();}, 
            function(){return b.Value();}
            ], 
            {strokeColor:'red', strokeWidth:2}
          );
  board.update();
} 
function clearAll() { 
  JXG.JSXGraph.freeBoard(board);
  board = JXG.JSXGraph.initBoard('jxgbox', {axis:true, boundingbox: [-5, 5, 5, -5]});
  a = board.createElement('slider', [[0,-1],[3,-1],[-4*Math.PI,0,0]], {style:6, name:'a'});
  b = board.createElement('slider', [[0,-2],[3,-2],[0,1,4*Math.PI]], {style:6, name:'b'});
}
plot();
