showInfobox color

62 views
Skip to first unread message

jean Mj

unread,
Apr 12, 2021, 9:41:02 AM4/12/21
to JSXGraph

Hello,  If showInfobox= true, the infobox is shown on mouse/pen over for all points.  Can I put another color than the default gray color ? thank you.

Alfred Wassermann

unread,
Apr 12, 2021, 5:11:52 PM4/12/21
to JSXGraph
Yes! The infobox element is nothing else than an internal text element. That means, you have to change the attributes before 
initializing the board or change its attributes later on with

board.infobox.setAttribute({key: value});

Further, the HTML div for the infobox element has the class .CSSinfobox. Here is an example (see it live at https://jsfiddle.net/tzmLn861/1/):

CSS:

.JXGinfobox {
  border-style: solid;
  border-radius: 5px;
  padding: 10px;
}

JavaScript:

JXG.Options.infobox.strokeColor = 'blue';
JXG.Options.infobox.fontSize = 24;

const board = JXG.JSXGraph.initBoard('jxgbox', { 
    boundingbox: [-5, 5, 5, -5], 
    axis: true
});

var p = board.create('point', [1, 2]);

board.infobox.setAttribute({strokeColor: 'red'});

Best wishes,
Alfred






Reply all
Reply to author
Forward
0 new messages