Difference between revisions of "Even simpler function plotter"
From JSXGraph Wiki
Jump to navigationJump to searchA WASSERMANN (talk | contribs) |
A WASSERMANN (talk | contribs) |
||
Line 2: | Line 2: | ||
<input type="text" id="input" value="sin(x)*x"> | <input type="text" id="input" value="sin(x)*x"> | ||
<input type="button" value="plot" onClick="plotter()"> | <input type="button" value="plot" onClick="plotter()"> | ||
− | <input type="button" value="clear all" onClick=" | + | <input type="button" value="clear all" onClick="clearAll()"> |
</form> | </form> | ||
</html> | </html> |
Revision as of 18:47, 22 March 2010
The underlying JavaScript code
var board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-5,8,8,-5], axis:true});
function plotter() {
var t = board.algebra.geonext2JS(document.getElementById('input').value);
var f = new Function('x','var y = '+t+'; return y;');
board.create('functiongraph',[f]);
}
function clearAll(board) {
JXG.JSXGraph.freeBoard(board);
board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-5,8,8,-5], axis:true});
}