Difference between revisions of "Random points"

From JSXGraph Wiki
Jump to: navigation, search
Line 50: Line 50:
 
<div id="box2" class="jxgbox" style="width:400px; height:400px;" onmouseover="board2.update()"></div>
 
<div id="box2" class="jxgbox" style="width:400px; height:400px;" onmouseover="board2.update()"></div>
 
<script language="JavaScript">
 
<script language="JavaScript">
 +
/*
 
  board2 = JXG.JSXGraph.initBoard('box2', {originX: 10, originY:390 , unitX:380 , unitY: 380});
 
  board2 = JXG.JSXGraph.initBoard('box2', {originX: 10, originY:390 , unitX:380 , unitY: 380});
 
  board2.suspendUpdate();
 
  board2.suspendUpdate();
Line 58: Line 59:
 
  }
 
  }
 
  board2.unsuspendUpdate();
 
  board2.unsuspendUpdate();
 +
*/
 
</script>
 
</script>
 
</html>
 
</html>

Revision as of 15:31, 7 December 2008

Draw 50 random points

        board = JXG.JSXGraph.initBoard('box', {originX: 10, originY:390 , unitX:380 , unitY: 380});
                
        function reload() {
            JXG.JSXGraph.freeBoard(board);        
            board = JXG.JSXGraph.initBoard('box', {originX: 10, originY: 390, unitX: 380, unitY: 380});            

            board.suspendUpdate();
            for (var i=0;i<50;i++) {
                var p = board.createElement('point',
                       [Math.random(),Math.random()],{style:5,name:' '});
            }
            board.unsuspendUpdate();
        }
        reload();

Draw 100 random points

These 100 points are updated on the onmouseover event and get new random coordinates.