Point: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 21: Line 21:
<br clear=all>
<br clear=all>
</html>
</html>


=== Attributes of a point ===
=== Attributes of a point ===
Several attributes can be given to change the properties of a point.
Several attributes can be given to change the properties of a point.
<source lang="javascript">
<source lang="javascript">
var board = JXG.JSXGraph.initBoard('jxgbox', {originX: 200, originY: 100, unitX: 50, unitY: 50});
var b2 = JXG.JSXGraph.initBoard('jxgbox2', {originX: 200, originY: 100, unitX: 50, unitY: 50});
var p = board.createElement('point',[1,1]);
var p = b2.createElement('point',[1,1], {name:'X',style:5});
</source>
</source>


Line 33: Line 32:
<div id="jxgbox2" class="jxgbox" style="width:500px; height:200px; float:left; "></div>
<div id="jxgbox2" class="jxgbox" style="width:500px; height:200px; float:left; "></div>
<script type="text/javascript">
<script type="text/javascript">
var b2 = JXG.JSXGraph.initBoard('jxgbox2', {originX: 200, originY: 100, unitX: 50, unitY: 50});
var b2 = JXG.JSXGraph.initBoard('jxgbox2', {originX: 200, originY: 100, unitX: 50, unitY: 50});
var p = b2.createElement('point',[1,1], {name:'X',style:5});
var p = b2.createElement('point',[1,1], {name:'X',style:5});
</script>
</script>
<br clear=all>
<br clear=all>

Revision as of 09:31, 17 September 2008

This example shows how to construct a simple, draggable point. It is produced by the following commands:

<div id="jxgbox" class="jxgbox" style="width:500px; height:200px; float:left; "></div>
<script type="text/javascript">
 var board = JXG.JSXGraph.initBoard('jxgbox', {originX: 200, originY: 100, unitX: 50, unitY: 50});
 var p = board.createElement('point',[1,1]);
</script>

The JavaScript code has to be placed AFTER the div element which will contain the construction. From now on, we will only show the JavaScript code.


Attributes of a point

Several attributes can be given to change the properties of a point.

var b2 = JXG.JSXGraph.initBoard('jxgbox2', {originX: 200, originY: 100, unitX: 50, unitY: 50});
var p = b2.createElement('point',[1,1], {name:'X',style:5});