Data plot: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
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 23:14, 11 February 2010