Moodle 4.2 JSXGraph 1.62 two boards give blank board

77 views
Skip to first unread message

Ahmed Ashour

unread,
Mar 26, 2024, 11:39:42 PM3/26/24
to JSXGraph
I construct the following which work fine with Moodle 3.9 and JSXgraph 1.4.6. or latest But after I upgrade Moodle to 4.2 it works fine with  JSXgraph 1.4.6. but with version 1.62 or the latest supplied version (automatically)  gives a blank board. Do I have to update this construction?
<style>
li {
  display: inline-block;
}
.displayNone{display:none}
.mytext {padding-block: 2;
  background-color:#d5f4e6;anchorX: 'middle';}
</li>
</style>
<li>
<div id="BOARDID0" class="jxgbox"  style="width:400px; height:400px">
</div></li>
<li>
<div id="BOARDID1" class="displayNone jxgbox" style="width:400px; height:400px">

</div>
</li>

<jsxgraph class=" displayNone jxgbox"  box="BOARDID0,BOARDID1"   numberOfBoards="2">

  JXG.Options = JXG.merge(JXG.Options, {
arrow: { strokeWidth: 3, strokeColor: "darkblue", fixed: true }
});
   var brd2 = JXG.JSXGraph.initBoard(BOARDID0, {showFullscreen: true,
  boundingbox: [-5,5, 5, -5],
  axis: true,
  showNavigation: false,
  keepaspectratio: true,
  showCopyright: false
});
 var chckbx = brd2.create('checkbox', [-1,-2, 'second board'],{size:14});
brd2.suspendUpdate();

brd2.unsuspendUpdate();
brd2.update();

var div1 = document.querySelector("#BOARDID1");
 JXG.addEvent(chckbx.rendNodeCheckbox, 'change', function() {
    if (this.Value()) {
        div1.classList.remove('displayNone');
    } else {
       div1.classList.add('displayNone');
    }
}, chckbx);

var brd1 = JXG.JSXGraph.initBoard(BOARDID1, {showFullscreen: true,
  boundingbox: [-5,5, 5, -5],
   axis: true,
  showNavigation: false,
  keepaspectratio: true,
  showCopyright: false
});

brd2.addChild(brd1);

brd1.suspendUpdate();
brd1.unsuspendUpdate();
brd1.update();
</jsxgraph>

Alfred Wassermann

unread,
Mar 27, 2024, 2:06:51 AM3/27/24
to JSXGraph
from your bug report, I assume that the file jsxgraphcore.js is not found by some reason.
Can you confirm this by having a look at the developers console?
There should be something like "JXG not declared".

Best wishes,
Alfred

A. W.

unread,
Mar 28, 2024, 8:21:23 AM3/28/24
to JSXGraph
Hello!

I have another suspicion as to why something is not working with this example. Here are some things I notice:
  • You are creating divs with  IDs BOARDID0 and BOARDID1. Further down you use the jsxgraph tag and seem to want to pass these IDs. This does not work. The JSXGraph tag is intended to ensure that divs do not have to be created in the first place. Instead, the JSXGraph tag ensures that a div and a script tag are created automatically. If you want to use it this way, you should use the classic div and script tag.
  • The use of the "box" attribute is deprecated. This is no longer required.
  • Under https://github.com/jsxgraph/moodle-filter_jsxgraph/blob/main/README.md you can read how the filter can be used at any time.
  • There actually seems to be an error. Even the minimal example
    const board0 = JXG.JSXGraph.initBoard(BOARDID0);
    board0.create('checkbox', [-1, -2, 'second board'], {});

    leads to an error: rendNodeTag does not seem to exist in the checkbox object. Maybe Alfred can help here, because I don't think it's the filter's fault, but JSXGraph.
We will release a new version of the filter after the Easter vacations. Perhaps the error will no longer exist in 1.8.0.

Best regards,
Andreas

Andreas Walter

unread,
Apr 4, 2024, 5:55:53 AM4/4/24
to JSXGraph
Please follow up this issue. It seems, that this addresses the same problem.

Alfred Wassermann

unread,
Apr 7, 2024, 3:45:40 PM4/7/24
to JSXGraph
Please try to use the attribute `parse:false` for the checkbox element.
Best wishes,
Alfred

Alfred Wassermann

unread,
Apr 22, 2024, 2:09:50 AM4/22/24
to JSXGraph
Finally, the root of the problem with quotation marks could be identified:
Moodle seems to manipulate the method String.at() and does not support negative values for the parameter (as does the original method).
This is fixed now. A new release will be published in this week.

Best wishes,
Alfred



Ahmed Ashour

unread,
Apr 24, 2024, 3:22:08 AM4/24/24
to jsxg...@googlegroups.com
Thanks Alfred and your team for a great job, Best wishes Ahmed

--
You received this message because you are subscribed to the Google Groups "JSXGraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jsxgraph+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jsxgraph/99ae209f-fd30-4f3a-a9d3-2238a636b509n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages