Difference between revisions of "Google style chart - interactive"

From JSXGraph Wiki
Jump to: navigation, search
Line 30: Line 30:
 
     p.rendNode._num = i;                          // memorize the number of this point in the array
 
     p.rendNode._num = i;                          // memorize the number of this point in the array
 
     p.rendNode.onclick = function() {
 
     p.rendNode.onclick = function() {
         var p = points[this._num+1];
+
        var i = this._num;                        // Now we can access the number again
 +
         var p = points[i+1];                       // The point number is one off
 
         var v = prompt("New value:", p.Y())*1.0;
 
         var v = prompt("New value:", p.Y())*1.0;
 
         p.setPosition(JXG.COORDS_BY_USER, p.X(), v);
 
         p.setPosition(JXG.COORDS_BY_USER, p.X(), v);
         y[this._num] = v;
+
         y[i] = v;
 
         brd.update();
 
         brd.update();
 
     };
 
     };

Revision as of 10:15, 6 July 2011