Difference between revisions of "Data plot"

From JSXGraph Wiki
Jump to navigationJump to search
 
(3 intermediate revisions by the same user not shown)
Line 6: Line 6:
 
var minY = 100000.0;
 
var minY = 100000.0;
  
var brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox:[-100,5000,25000,-400],axis:true});
+
var brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox:[-1,5000,25,-400],axis:true});
  
 
var plotData = function() {
 
var plotData = function() {
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 08:41, 6 July 2011


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