Texts: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 4: Line 4:
     // Vertical line at x=3
     // Vertical line at x=3
     var A = brd.create('point', [2, 5], {strokeWidth:1, dash:2, name: 'A_1'});   
     var A = brd.create('point', [2, 5], {strokeWidth:1, dash:2, name: 'A_1'});   
     brd.create('text', [3, 8, function () { return 'X(A) = ' + A.X(); }]);
     brd.create('text', [3, 8, function () { return 'X(A_1) = ' + A.X(); }]);


     brd.on('update', function () {
     brd.on('update', function () {

Revision as of 09:12, 25 April 2017

The underlying JavaScript code

    var brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox: [-1,10,7,-1], axis:false, keepaspectratio:false});

    // Vertical line at x=3
    var A = brd.create('point', [2, 5], {strokeWidth:1, dash:2});  
    brd.create('text', [3, 8, function () { return 'X(A) = ' + A.X(); }]);

    brd.on('update', function () {
        document.getElementById('out').innerHTML = 'X(A) = ' + A.X();
    });
    <div id="out"></div>