|
|
Zeile 123: |
Zeile 123: |
| return `\\[\\int_{${a}}^{${b}} f(x) \\, dx = ${value}\\]`; | | return `\\[\\int_{${a}}^{${b}} f(x) \\, dx = ${value}\\]`; |
| }); | | }); |
| i1.baseLeft.on('drag', function() {
| |
| i1.label.setText(() => {
| |
| const a = i1.baseLeft.X().toFixed(2);
| |
| const b = i1.baseRight.X().toFixed(2);
| |
| const value = i1.Value().toFixed(4);
| |
| return `\\[\\int_{${a}}^{${b}} f(x) \\, dx = ${value}\\]`;
| |
| });
| |
| MathJax.typesetPromise().then(() => {
| |
| console.log("MathJax rendering complete.");
| |
| });
| |
| });
| |
|
| |
|
| i1.baseRight.on('drag', function() {
| |
| i1.label.setText(() => {
| |
| const a = i1.baseLeft.X().toFixed(2);
| |
| const b = i1.baseRight.X().toFixed(2);
| |
| const value = i1.Value().toFixed(4);
| |
| return `\\[\\int_{${a}}^{${b}} f(x) \\, dx = ${value}\\]`;
| |
| });
| |
| MathJax.typesetPromise().then(() => {
| |
| console.log("MathJax rendering complete.");
| |
| });
| |
| });
| |
| // Beschriftung der Funktion mit f | | // Beschriftung der Funktion mit f |
| board.create('text', [3.5, 3, 'f'], { | | board.create('text', [3.5, 3, 'f'], { |
Zeile 154: |
Zeile 132: |
| color: 'blue' | | color: 'blue' |
| }); | | }); |
| const labelElement = document.createElement('div');
| |
| labelElement.id = 'integral-label';
| |
| document.body.appendChild(labelElement);
| |
|
| |
| const updateLabel = () => {
| |
| const a = i1.baseLeft.X().toFixed(2);
| |
| const b = i1.baseRight.X().toFixed(2);
| |
| const value = i1.Value().toFixed(4);
| |
| labelElement.innerHTML = `\\[\\int_{${a}}^{${b}} f(x) \\, dx = ${value}\\]`;
| |
| MathJax.typesetPromise();
| |
| };
| |
|
| |
| i1.baseLeft.on('drag', updateLabel);
| |
| i1.baseRight.on('drag', updateLabel);
| |
|
| |
| // Initiales Rendern
| |
| updateLabel();
| |
| </script> | | </script> |
| </body> | | </body> |