JSXGraph logo
JSXGraph
JSXGraph share

Share

Implicit curve plotter
QR code
<iframe 
    src="https://www.jsxgraph.org/share/iframe/implicit-curve-plotter" 
    style="border: 1px solid black; overflow: hidden; width: 550px; aspect-ratio: 55 / 65;" 
    name="JSXGraph example: Implicit curve plotter" 
    allowfullscreen
></iframe>
This code has to
<span>0 = </span>
<input id="function" type="text" 
    style="font-size:80%; width:400px; float:right;"
    placeholder="x^2 - y^2 - 1"
    value="x^2 - y^2 - 1">
<br />
<button onClick="plot();">plot</button>
<button onClick="clearAll();">clear all</button>

<div id="board-0-wrapper" class="jxgbox-wrapper " style="width: 100%; ">
   <div id="board-0" class="jxgbox" style="aspect-ratio: 1 / 1; width: 100%;" data-ar="1 / 1"></div>
</div>

<script type = "text/javascript"> 
    /*
    This example is licensed under a 
    Creative Commons Attribution ShareAlike 4.0 International License.
    https://creativecommons.org/licenses/by-sa/4.0/
    
    Please note you have to mention 
    The Center of Mobile Learning with Digital Technology
    in the credits.
    */
    
    const BOARDID = 'board-0';

    window.board = JXG.JSXGraph.initBoard(BOARDID, {
        boundingbox: [-8, 8, 8, -8],
        axis: true,
        showFullscreen: true
    });
    
    var c = window.board.create('implicitcurve', ["x^2 - y^2 - 1"], {
        strokeWidth: 3,
        strokeColor: JXG.palette.red,
        strokeOpacity: 0.6,
        resolution_outer: 1,
        resolution_inner: 1
    });
    
    window.plot = function() {
        window.board.create('implicitcurve', [document.getElementById('function').value], {
            strokeWidth: 3,
            strokeColor: JXG.palette.red,
            strokeOpacity: 0.6,
            resolution_outer: 1,
            resolution_inner: 1,
            h_max: 0.05
        });
    };
    
    window.clearAll = function() {
        JXG.JSXGraph.freeBoard(window.board);
        window.board = JXG.JSXGraph.initBoard(BOARDID, {
            boundingbox: [-8, 8, 8, -8],
            axis: true
        });
    };
 </script> 
/*
This example is licensed under a 
Creative Commons Attribution ShareAlike 4.0 International License.
https://creativecommons.org/licenses/by-sa/4.0/

Please note you have to mention 
The Center of Mobile Learning with Digital Technology
in the credits.
*/

const BOARDID = 'your_div_id'; // Insert your id here!

window.board = JXG.JSXGraph.initBoard(BOARDID, {
    boundingbox: [-8, 8, 8, -8],
    axis: true,
    showFullscreen: true
});

var c = window.board.create('implicitcurve', ["x^2 - y^2 - 1"], {
    strokeWidth: 3,
    strokeColor: JXG.palette.red,
    strokeOpacity: 0.6,
    resolution_outer: 1,
    resolution_inner: 1
});

window.plot = function() {
    window.board.create('implicitcurve', [document.getElementById('function').value], {
        strokeWidth: 3,
        strokeColor: JXG.palette.red,
        strokeOpacity: 0.6,
        resolution_outer: 1,
        resolution_inner: 1,
        h_max: 0.05
    });
};

window.clearAll = function() {
    JXG.JSXGraph.freeBoard(window.board);
    window.board = JXG.JSXGraph.initBoard(BOARDID, {
        boundingbox: [-8, 8, 8, -8],
        axis: true
    });
};

Implicit curve plotter

Plot an implicit curve in the affine space \(\mathbb{R}^2\). It is mandatory to use the variables `x` and `y`. __For developers:__ Internally, the JavaScript code is capsuled in an anonymous function using the trick `(function() { ... })();`. However, to make the buttons work, we need `board`, `clearAll()`, and `plot()` to be global variables. This is achieved by using `window.board`, `window.clearAll()`, and `window.plot()`.
0 =
<span>0 = </span>
<input id="function" type="text" 
    style="font-size:80%; width:400px; float:right;"
    placeholder="x^2 - y^2 - 1"
    value="x^2 - y^2 - 1">
<br />
<button onClick="plot();">plot</button>
<button onClick="clearAll();">clear all</button>
// Define the id of your board in BOARDID

window.board = JXG.JSXGraph.initBoard(BOARDID, {
    boundingbox: [-8, 8, 8, -8],
    axis: true,
    showFullscreen: true
});

var c = window.board.create('implicitcurve', ["x^2 - y^2 - 1"], {
    strokeWidth: 3,
    strokeColor: JXG.palette.red,
    strokeOpacity: 0.6,
    resolution_outer: 1,
    resolution_inner: 1
});

window.plot = function() {
    window.board.create('implicitcurve', [document.getElementById('function').value], {
        strokeWidth: 3,
        strokeColor: JXG.palette.red,
        strokeOpacity: 0.6,
        resolution_outer: 1,
        resolution_inner: 1,
        h_max: 0.05
    });
};

window.clearAll = function() {
    JXG.JSXGraph.freeBoard(window.board);
    window.board = JXG.JSXGraph.initBoard(BOARDID, {
        boundingbox: [-8, 8, 8, -8],
        axis: true
    });
};

license

This example is licensed under a Creative Commons Attribution ShareAlike 4.0 International License.
Please note you have to mention The Center of Mobile Learning with Digital Technology in the credits.