Grouping objects: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
 
Line 11: Line 11:
</jsxgraph>
</jsxgraph>


===The underlying JavaScript code===
==The underlying JavaScript code==
<source lang="javascript">
<source lang="javascript">
var b1 = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-4, 3, 6, -3]});
var b1 = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-4, 3, 6, -3]});

Latest revision as of 14:34, 7 June 2011

The underlying JavaScript code

var b1 = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-4, 3, 6, -3]});
var pArr = [];
pArr[0] = b1.create('point',[0,0], {size:4});
pArr[1] = b1.create('point',[2,1], {size:4});
pArr[2] = b1.create('point',[2,2], {size:4});
pArr[3] = b1.create('point',[0,1], {size:4});

var poly = b1.create('polygon',pArr);

The points are grouped together with the following command:

var gr = b1.create('group',pArr);