Difference between revisions of "Data plot"

From JSXGraph Wiki
Jump to navigationJump to search
Line 7: Line 7:
 
     var t = document.getElementById('in_data').value;
 
     var t = document.getElementById('in_data').value;
 
     var data = t.split('\n');
 
     var data = t.split('\n');
 +
    var maX = 0.0;
 +
    var maY = 0.0;
 
     for (i=0;i<data.length;i++) {
 
     for (i=0;i<data.length;i++) {
 
         d = data[i].split(';');
 
         d = data[i].split(';');
 
         x[i] = d[1]*1.0;
 
         x[i] = d[1]*1.0;
 
         y[i] = d[0]*1.0;
 
         y[i] = d[0]*1.0;
 +
        if (x[i]>maxX) maxX = x[i];
 +
        if (y[i]>maxY) maxY = y[i];
 
     }
 
     }
    var maX = JXG.MathStatistics.max(x);
 
    var maY = JXG.MathStatistics.max(y);
 
 
     brd.setBoundingBox([-100,maxX,maxY,-400]);
 
     brd.setBoundingBox([-100,maxX,maxY,-400]);
 
     c.dataX = x;
 
     c.dataX = x;

Revision as of 00:14, 12 February 2010