Data plot: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 1: Line 1:
<jsxgraph width="600" height="500">
<jsxgraph width="600" height="500">
var color = ['blue',red','yellow', 'magenta', 'green', 'black'];
var nr = 0;
var brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox:[-100,5000,25000,-400],axis:true});
var brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox:[-100,5000,25000,-400],axis:true});
var c = brd.create('curve',[[0],[0]],{strokeColor:'red'});


var plotData = function() {
var plotData = function() {
Line 17: Line 19:
     }
     }
     brd.setBoundingBox([-100,maxY,maxX,-400]);
     brd.setBoundingBox([-100,maxY,maxX,-400]);
     c.dataX = x;
     var c = brd.create('curve',[x,y],{strokeColor:color[nr%color.length]});
     c.dataY = y;
     nr++;
     brd.update();
     brd.update();
}
}
 
var clear = function() {
    JXG.JSXGraph.freeBoard(brd);
    brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox:[-100,5000,25000,-400],axis:true});
}
</jsxgraph>
</jsxgraph>
<html>
<html>
<form>
<form>
<input type="button" value="plot data" onClick="plotData()">
<input type="button" value="plot data" onClick="plotData()">
<input type="button" value="clear all" onClick="clear()">
<textarea id="in_data" cols=20 rows=15>
<textarea id="in_data" cols=20 rows=15>
</textarea>
</textarea>
</form>
</form>
</html>
</html>

Revision as of 23:24, 11 February 2010