Texts: Difference between revisions
From JSXGraph Wiki
| A WASSERMANN (talk | contribs) No edit summary | A WASSERMANN (talk | contribs) No edit summary | ||
| (One intermediate revision by the same user not shown) | |||
| 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( |      brd.create('text', [3, 8, function () { return 'X(A_1) = ' + A.X().toFixed(2); }]); | ||
|      brd.on('update', function () { |      brd.on('update', function () { | ||
|          document.getElementById('out').innerHTML = 'X( |          document.getElementById('out').innerHTML = 'X(A<sub>1</sub>) = ' + A.X().toFixed(2); | ||
|      }); |      }); | ||
| </jsxgraph> | </jsxgraph> | ||
| Line 19: | Line 19: | ||
|      // Vertical line at x=3 |      // Vertical line at x=3 | ||
|      var A = brd.create('point', [2, 5], {strokeWidth:1, dash:2});    |      var A = brd.create('point', [2, 5], {strokeWidth:1, dash:2, name: 'A_1'});    | ||
|      brd.create('text', [3, 8, function () { return 'X( |      brd.create('text', [3, 8, function () { return 'X(A_1) = ' + A.X().toFixed(2); }]); | ||
|      brd.on('update', function () { |      brd.on('update', function () { | ||
|          document.getElementById('out').innerHTML = 'X(A) = ' + A.X(); |          document.getElementById('out').innerHTML = 'X(A<sub>1</sub>) = ' + A.X().toFixed(2); | ||
|      }); |      }); | ||
| </source> | </source> | ||
Latest revision as of 09:13, 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, name: 'A_1'});  
    brd.create('text', [3, 8, function () { return 'X(A_1) = ' + A.X().toFixed(2); }]);
    brd.on('update', function () {
        document.getElementById('out').innerHTML = 'X(A<sub>1</sub>) = ' + A.X().toFixed(2);
    });
    <div id="out"></div>
