Data plot: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 12: | Line 12: | ||
var t = document.getElementById('in_data').value; | var t = document.getElementById('in_data').value; | ||
var data = t.split('\n'); | var data = t.split('\n'); | ||
for (i=0;i<data.length-1;i++) { | for (i=0;i<data.length-1;i++) { | ||
d = data[i].split(';'); | d = data[i].split(';'); | ||
Line 21: | Line 20: | ||
if (y[i]<minY) minY = y[i]; | if (y[i]<minY) minY = y[i]; | ||
} | } | ||
brd.setBoundingBox([- | brd.setBoundingBox([-1,maxY*1.01,maxX*1.05,minY*0.95]); | ||
var c = brd.create('curve',[x,y],{strokeColor:color[nr%color.length]}); | var c = brd.create('curve',[x,y],{strokeColor:color[nr%color.length]}); | ||
nr++; | nr++; | ||
Line 29: | Line 28: | ||
var clearBoard = function() { | var clearBoard = function() { | ||
JXG.JSXGraph.freeBoard(brd); | JXG.JSXGraph.freeBoard(brd); | ||
brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox:[-100,5000, | brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox:[-100,5000,25,-400],axis:true}); | ||
maxX = 0.0; | maxX = 0.0; | ||
maxY = 0.0; | maxY = 0.0; |