Difference between revisions of "Polar curve plotter"

From JSXGraph Wiki
Jump to navigationJump to search
(New page: <html> <p> <textarea cols=60 rows=4 id="eingabe">function r(t) {return t; }; </textarea><br /> <input type="button" value="plot" onClick="plot()"> <input type="button" value="clear a...)
 
Line 14: Line 14:
 
   eval(document.getElementById("eingabe").value);
 
   eval(document.getElementById("eingabe").value);
 
   graph = board.createElement('curve', [
 
   graph = board.createElement('curve', [
             x,y,  
+
             r,  
 
             function(){return a.Value();},  
 
             function(){return a.Value();},  
 
             function(){return b.Value();}
 
             function(){return b.Value();}
 
             ],  
 
             ],  
             {strokeColor:'red', strokeWidth:2}
+
             {curveTpye:'polar',strokeColor:'red', strokeWidth:2}
 
           );
 
           );
 
   board.update();
 
   board.update();

Revision as of 21:47, 1 July 2009


The JavaScript code

<source lang="javascript"> 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, originX: 250, originY: 250, unitX: 50, unitY: 50});
 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(); <source>