Data plot: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) 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 plotData = function() { | var plotData = function() { | ||
Line 17: | Line 19: | ||
} | } | ||
brd.setBoundingBox([-100,maxY,maxX,-400]); | brd.setBoundingBox([-100,maxY,maxX,-400]); | ||
c. | var c = brd.create('curve',[x,y],{strokeColor:color[nr%color.length]}); | ||
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> |