Grouping objects: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
< | <jsxgraph width="500" height="300" box="jxgbox"> | ||
var b1 = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-4, 3, 6, -3]}); | |||
var b1 = JXG.JSXGraph.initBoard('jxgbox', { | |||
var pArr = []; | var pArr = []; | ||
pArr[0] = b1. | pArr[0] = b1.create('point',[0,0], {size:4}); | ||
pArr[1] = b1. | pArr[1] = b1.create('point',[2,1], {size:4}); | ||
pArr[2] = b1. | pArr[2] = b1.create('point',[2,2], {size:4}); | ||
pArr[3] = b1. | pArr[3] = b1.create('point',[0,1], {size:4}); | ||
var poly = b1. | var poly = b1.create('polygon',pArr); | ||
var gr = b1. | var gr = b1.create('group',pArr); | ||
</ | </jsxgraph> | ||
===The underlying JavaScript code=== | ===The underlying JavaScript code=== | ||
<source lang="javascript"> | <source lang="javascript"> | ||
var b1 = JXG.JSXGraph.initBoard('jxgbox', { | var b1 = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-4, 3, 6, -3]}); | ||
var pArr = []; | var pArr = []; | ||
pArr[0] = b1. | pArr[0] = b1.create('point',[0,0], {size:4}); | ||
pArr[1] = b1. | pArr[1] = b1.create('point',[2,1], {size:4}); | ||
pArr[2] = b1. | pArr[2] = b1.create('point',[2,2], {size:4}); | ||
pArr[3] = b1. | pArr[3] = b1.create('point',[0,1], {size:4}); | ||
var poly = b1. | var poly = b1.create('polygon',pArr); | ||
</source> | </source> | ||
The points are grouped together with the following command: | The points are grouped together with the following command: | ||
<source lang="javascript"> | <source lang="javascript"> | ||
var gr = b1. | var gr = b1.create('group',pArr); | ||
</source> | </source> | ||
[[Category:Examples]] | [[Category:Examples]] |
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);