JSXGraph

Filters ::: filter_jsxgraph
Maintained by Andreas Walter
JSXGraph is a cross-browser JavaScript library for interactive geometry, function plotting, charting, and data visualization in the web browser. This is a plugin for Moodle to enable function plotting and dynamic geometry constructions with JSXGraph within a Moodle platform. Using the JSXGraph filter makes it a lot easier to embed JSXGraph constructions into Moodle online documents, e.g. in contents like page, quiz, link,...
Latest release:
412 sites
152 downloads
26 fans
Current versions available: 3

About JSXGraph

JSXGraph is a cross-browser JavaScript library for interactive geometry, function plotting, charting, and data visualization in the web browser. JSXGraph is implemented in pure JavaScript and does not rely on any other library. Special care has been taken to optimize the performance.

Have a look at www.jsxgraph.org.

Features

  • Open source
  • High-performance, small footprint
  • No dependencies
  • Multi-touch support

Our filter

This is a plugin for Moodle to enable function plotting and dynamic geometry constructions with JSXGraph within a Moodle platform. Using the  JSXGraph filter makes it a lot easier to embed JSXGraph constructions into Moodle online documents, e.g. in contents like page, quiz, link,...

Usage

  1. In a Moodle course you can add an board to different types of content, i.e.:

    • Add an activity or resource -> Page
    • Add an activity or resource -> Link
    • Add an activity or resource -> Quiz
    • ...
  2. Write content. At the position the construction should appear, create a construction by:

    • switching to the code input, i.e. to "HTML source editor"
    • inserting a <jsxgraph> tag with all required parameters
    • Each <div> that contains a JSXGraph board needs a unique ID on the page. You can specify this ID within the tag (see here). Otherwise an ID is generated automatically. Reference it within the JavaScript using the constant BOARDID.

    Example:

    <jsxgraph width="600" height="500">
        var brd = JXG.JSXGraph.initBoard(BOARDID, {boundingbox:[-5,5,5,-5], axis:true});
        var p = brd.create('point', [1,2]);
    </jsxgraph>

For tag attributes and more settings have a look at https://github.com/jsxgraph/moodle-jsxgraph-plugin/blob/master/README.md.

For using JSXGraph within a formulas question see here: https://github.com/jsxgraph/moodleformulas_jsxgraph/blob/master/README.md.

Have a look to this 

Be aware of the fact, that you don't see the construction unless you leave the editor and save your document. On reopening it later, you will notice the code rather than the <jsxgraph> tag. To edit your content later, again switch to the code input.

Using multipe boards in one tag

It is possible to replace a jsxgraph tag with more than one board. To do this, enter a number in the tag attribute numberOfBoards. This does the following:

  • Instead of BOARDID, the unique ids can now be found in BOARDID0, BOARDID1, BOARDID2, ...
  • The attributes width, height, title and description can contain several values. These are separated by commas. The first value applies to the first board, the second value to the second, etc. If not enough values are given (especially only one), the first value is used for the other boards.

Example:

<jsxgraph width="500,200" height="500,200" numberOfBoards="2">
   var board = JXG.JSXGraph.initBoard(BOARDID0, {boundingbox: [-1.33, 1.33, 1.33, -1.33], axis: true, showNavigation:false});
   var board2 = JXG.JSXGraph.initBoard(BOARDID1, {boundingbox: [-1, 1.33, 7, -1.33], showNavigation:false});

   board.suspendUpdate();
   var b1c1 = board.create('circle', 0,0], [1,0, {fixed:true});
   var b1p1 = board.create('point', [2, 0], {slideObject: b1c1});
   var perp = board.create('perpendicular', [board.defaultAxes.x,b1p1],[{strokeColor: '#ff0000', visible: true}, {visible: false}]);
   var perp2 = board.create('perpendicular',[board.defaultAxes.y,b1p1],[{strokeColor: '#0000ff', visible: true}, {visible: false}]);
   board.unsuspendUpdate();

   board2.suspendUpdate();
   var xax2 = board2.create('axis', 0,0], [1,0);
   board2.create('axis', 0,0], [0,1);
   board2.create('ticks', [xax2, [Math.PI, 2*Math.PI]], {strokeColor: 'green', strokeWidth: 2});
   
   // sine:
   var b2p1 = board2.create('point', [
                function(){ return JXG.Math.Geometry.rad([1,0],[0,0],b1p1); }, 
                function() { return b1p1.Y() }], 
                {fixed: true, trace: true, color: '#ff0000', name: 'S'});
   // cosine:
   var b2p2 = board2.create('point', [
                function(){ return JXG.Math.Geometry.rad([1,0],[0,0],b1p1); }, 
                function() { return b1p1.X() }], 
                {fixed: true, trace: true, color: '#0000ff', name: 'C'});
   // Dependencies (only necessary if b2p1 or b2p2 is deleted)
   b1p1.addChild(b2p1);
   b1p1.addChild(b2p2);
   board2.unsuspendUpdate();

   board.addChild(board2);
</jsxgraph>

Screenshots

Screenshot #0
Screenshot #1
Screenshot #2
Screenshot #3
Screenshot #4
Screenshot #5
Screenshot #6
Screenshot #7

Contributors

Andreas Walter (Lead maintainer): Developer
Please login to view contributors details and/or to contact them

Comments RSS

Visualizza commenti
  • Ricardo Caiado
    mer, 27 gen 2021, 02:37
    I am installing from Moodle Directory, not from GitHub.

  • Ricardo Caiado
    mer, 27 gen 2021, 02:38
    It seems everything is ok now...
  • Andreas Walter
    mer, 27 gen 2021, 02:41
    Our bug tracker is on GitHub (see link above).
    But your problem seems to be a Moodle/cache bug: https://moodle.org/mod/forum/discuss.php?d=398091.
  • Ricardo Caiado
    mer, 27 gen 2021, 02:48
    Thanks. Installation was successful!

  • Paul
    sab, 26 feb 2022, 00:56
    When we copied a series of questions from one course to another new course, the graph doesn't display. Can you think of any reason why this might happen?
  • Paul
    lun, 28 feb 2022, 14:48
    To add to my report above this is what we did. We set up a course using Stack with the Graph plugin and created a quiz for the students, the quiz has around 15 questions. We ran this for a semester and then, at the start of the next semester we wanted to reuse the material so tried to copy the course from last semester to this one. In the process, all the materials came across, but when we open the quiz, the graphs do not display.

    We then tried to back up the course and restore it new, that too failed to display the graphs. We then tried to backup and restore just the quiz content, that too failed.

    The only approach that seems to work is to create a new quiz and pull in the questions from the question bank. This, however, is a rather long winded way of having to do the job.
  • Paul
    lun, 28 feb 2022, 15:50
    We have also found that a one off question can be backed up and restored, but the problem seems to start when you have a quiz with multiple question?
  • Andreas Walter
    mer, 2 mar 2022, 20:39
    Dear Paul,
    I see you have already opened a case in our bug tracker at https://github.com/jsxgraph/moodle-filter_jsxgraph/issues. I would have suggested that too, since we can discuss things better there and exchange files. I will answer there. For others: This specific issue can be find under https://github.com/jsxgraph/moodle-filter_jsxgraph/issues/25.
    Andreas
  • Ivan Muñoz
    gio, 28 apr 2022, 05:25
    Hi Mr. Walter
    Does The version 1.4.3. Work well in Moodle version 3.11.6 and 4.0?

    I have tried but the question didn't show the graphical. Will it be solved in a future?
    Thanks you
  • Andreas Walter
    gio, 28 apr 2022, 14:21
    Dear Ivan!

    I tested the moodle filter in my test environment (version 3.11.6) before the release and found no errors. By the way, the core functionality of the filter has not changed in this release. In my test environment, all boards are displayed correctly in activities - also in formulas questions.
    If you find any errors, please check your installation again. If these continue to occur, please report them using the following link as the comments in the Plugins directory are NOT intended for this: https://github.com/jsxgraph/moodle-filter_jsxgraph/issues

    The current release only supports Moodle versions 2.9 to 3.11. You can also read about this under "versions". A version of the filter for Moodle 4.0 is planned, but will take a few more weeks. I ask for patience here.

    Best regards,
    Andrew Walter
  • Ivan Muñoz
    ven, 29 apr 2022, 01:42
    Thanks you Andreas. I will write you in github site. You're so kindly.
  • Wendy Harper
    sab, 17 giu 2023, 01:12
    JSXgraph was not working when I installed the 4.2 update. I returned to moodle 4.13 and it is working. Will the plugin be updated to work in moodle 4.2 and 4.3?
  • Andreas Walter
    sab, 17 giu 2023, 04:48
    Dear Wendy, thank you very much for the information. I added your issue to our bug tracker: https://github.com/jsxgraph/moodle-filter_jsxgraph/issues/32. We are working to solve the issue. There will definitely be a version for Moodle 4.2 and 4.3. This will also support JSXGraph 1.5.0 (and upcoming 1.6.0). Unfortunately, our work is still taking a little time for various reasons. We ask for your understanding! We take care!
  • Wendy Harper
    lun, 3 lug 2023, 06:05
    I posted in the moodle in English forum in Quizzes. I am having trouble getting the users answer to be fixed on the screen. fixed: question.isSolved is not working. I would appreciate any suggestions.
  • Andreas Walter
    lun, 3 lug 2023, 15:11
    Dear Wendy!
    Our bug tracker is right here: https://github.com/jsxgraph/moodle-filter_jsxgraph/issues. Would you please open a new issue with your problem and attach some minimal example as Moodle-XML file? Then we can definitely help you!
    Andreas
1 2
Please login to post comments