# Difference between revisions of "Use the MediaWiki extension for JSXGraph"

From JSXGraph Wiki

Jump to navigationJump to searchA WASSERMANN (talk | contribs) |
A WASSERMANN (talk | contribs) |
||

Line 24: | Line 24: | ||

<source lang="xml"> | <source lang="xml"> | ||

<jsxgraph height="500" width="600" box="jxgbox2"> | <jsxgraph height="500" width="600" box="jxgbox2"> | ||

− | + | board = JXG.JSXGraph.initBoard('jxgbox2', {originX: 250, originY: 250, unitX: 25, unitY: 25}); | |

− | + | var a = board.createElement('slider', [[1,-1],[5,-1],[0,1,4]]); | |

− | + | var b = board.createElement('slider', [[1,-2],[5,-2],[0,0.25,4]]); | |

− | + | var c = board.createElement('curve', [function(phi){return a.Value()+b.Value()*phi; }, [0, 0],'phi',0, 8*Math.PI], | |

− | + | {curveType:'polar', strokewidth:4}); | |

</jsxgraph> | </jsxgraph> | ||

</source> | </source> |

## Revision as of 17:18, 24 February 2009

An extension to include JSXgraph in MediaWiki is under development, see also http://www.mediawiki.org/wiki/Extension:JSXGraph. You an see it in action here:

### Include a GEONExT file

To display the above example, a GEONExT file has to be uploaded and the following code has to be included in a MediWiki page:

```
<jsxgraph height="500" width="600" filename="Wuerfel_drehbar_dreieck.gxt" />
```

### Include JavaScript source code

Since it is already the second example on this page, we have to overwrite the default name of the division that will contain the construction. We do this by supplying the attribut*box=jxgbox2*.

```
<jsxgraph height="500" width="600" box="jxgbox2">
board = JXG.JSXGraph.initBoard('jxgbox2', {originX: 250, originY: 250, unitX: 25, unitY: 25});
var a = board.createElement('slider', [[1,-1],[5,-1],[0,1,4]]);
var b = board.createElement('slider', [[1,-2],[5,-2],[0,0.25,4]]);
var c = board.createElement('curve', [function(phi){return a.Value()+b.Value()*phi; }, [0, 0],'phi',0, 8*Math.PI],
{curveType:'polar', strokewidth:4});
</jsxgraph>
```

### Include GEONExT string

Include a GEONExT construction as string:
The attribut *filestring* contains the content of a GEONExT file.