# Grouping objects

From JSXGraph Wiki

Revision as of 10:10, 17 December 2008 by A WASSERMANN (talk | contribs)

### 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 = b1.createElement('group',pArr);
```

The points are grouped together with the following command:

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