does the css example on jsxgraph’s website for jsxgraph work?

Indeed, the example in the wiki is outdated. The priorities of CSS classes, default CSS styles and JSXGraph are a little bit delicate.Please, have a look at the API docs: https://jsxgraph.org/docs/symbols/Text.html#cssDefaultStyle. If you want to overwrite font-family, you have to set cssDefaultStyle to the empty string:

JXG.Options.text.cssDefaultStyle = '';
JXG.Options.text.highlightCssDefaultStyle = '';

const board = JXG.JSXGraph.initBoard('jxgbox', {
    boundingbox: [-1,15,15,-1],
    showcopyright: false,
    axis: true,
    // ...
    });

    var txt = board.create('text', [3,4, 
        " <span id='par'>(</span> Hello world <span id='par'>)</span>"
     ], {
        cssClass:'myFont',
        highlightCssClass: 'myFont',
        strokeColor: 'red',
        highlightStrokeColor: 'blue',
        fontSize:20
      });

See it live at https://jsfiddle.net/2jq8srpv/3/

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top