Grouping objects: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 14: | Line 14: | ||
var poly = b1.createElement('polygon',pArr); | var poly = b1.createElement('polygon',pArr); | ||
var gr = new JXG.Group(b1,'','',pArr); | var gr = new JXG.Group(b1,'','',pArr); | ||
</script> | </script> | ||
</html> | </html> | ||
===The underlying JavaScript code=== | |||
<source lang="javascript"> | |||
var b1 = JXG.JSXGraph.initBoard('jxgbox', {originX: 200, originY: 150, unitX: 50, unitY: 50}); | |||
var pArr = []; | |||
pArr[0] = b1.createElement('point',[0,0], {name:'A',style:6}); | |||
pArr[1] = b1.createElement('point',[2,1], {name:'B',style:6}); | |||
pArr[2] = b1.createElement('point',[2,2], {name:'C',style:6}); | |||
pArr[3] = b1.createElement('point',[0,1], {name:'D',style:6}); | |||
var poly = b1.createElement('polygon',pArr); | |||
var gr = new JXG.Group(b1,'','',pArr); | |||
</source> | |||
The points are grouped together with the command | |||
<source lang="javascript"> | |||
var gr = new JXG.Group(b1,'','',pArr); | |||
</source> | |||
In the next release (>0.66) this will be replaced by | |||
<source lang="javascript"> | |||
var gr = b1.createElement('group',pArr); | |||
</source> | |||
[[Category:Examples]] | [[Category:Examples]] |
Revision as of 13:23, 16 December 2008
The underlying JavaScript code
var b1 = JXG.JSXGraph.initBoard('jxgbox', {originX: 200, originY: 150, unitX: 50, unitY: 50});
var pArr = [];
pArr[0] = b1.createElement('point',[0,0], {name:'A',style:6});
pArr[1] = b1.createElement('point',[2,1], {name:'B',style:6});
pArr[2] = b1.createElement('point',[2,2], {name:'C',style:6});
pArr[3] = b1.createElement('point',[0,1], {name:'D',style:6});
var poly = b1.createElement('polygon',pArr);
var gr = new JXG.Group(b1,'','',pArr);
The points are grouped together with the command
var gr = new JXG.Group(b1,'','',pArr);
In the next release (>0.66) this will be replaced by
var gr = b1.createElement('group',pArr);