Data plot: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
 
(2 intermediate revisions 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');
    data.sort();
     for (i=0;i<data.length-1;i++) {
     for (i=0;i<data.length-1;i++) {
         d = data[i].split(';');
         d = data[i].split(';');
         x[i] = d[1]*1.0;
         x[i] = d[0]*1.0;
         y[i] = d[0]*1.0;
         y[i] = d[1]*1.0;
         if (x[i]>maxX) maxX = x[i];
         if (x[i]>maxX) maxX = x[i];
         if (y[i]>maxY) maxY = y[i];
         if (y[i]>maxY) maxY = y[i];
         if (y[i]<minY) minY = y[i];
         if (y[i]<minY) minY = y[i];
     }
     }
     brd.setBoundingBox([-100,maxY*1.01,maxX*1.05,minY*0.95]);
     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,25000,-400],axis:true});
     brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox:[-100,5000,25,-400],axis:true});
     maxX = 0.0;
     maxX = 0.0;
     maxY = 0.0;
     maxY = 0.0;

Latest revision as of 07:41, 6 July 2011


Spalte 1: y-Koordinate, Spalte 2: x-Koordinate