var brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-15, 20, 15, -10], keepaspectratio:true, axis: true});
var p1 = brd.create('point',[0,0]);
var p2 = brd.create('point',[5,5]);
var circle = brd.create('circle',[p1,p2],{hasInnerPoints:true,fixed:false});
var text = brd.create('text', [10,10, function() {
return "Circle radius = " + circle.Radius();
}], {display: 'html', visible: false}); // Text displaying the circle radius
// Modify highlight and noHighlight method of circle.
circle.highlight = function(){
if (this.visProp.highlight) {
text.setAttribute({visible:true}); // show text element
this.highlighted = true;
this.board.highlightedObjects[this.id] = this;
this.board.renderer.highlight(this);
}
return this;
}
circle.noHighlight = function(){
if (this.highlighted) {
text.setAttribute({visible:false}); // hide text element
this.highlighted = false;
delete this.board.highlightedObjects[this.id];
this.board.renderer.noHighlight(this);
}
return this;
}
var brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-15, 20, 15, -10], keepaspectratio:true, axis: true});
var p1 = brd.create('point',[0,0]);
var p2 = brd.create('point',[5,5]);
var circle = brd.create('circle',[p1,p2],{hasInnerPoints:true,fixed:false});
var text = brd.create('text', [10,10, function() {
return "Circle radius = " + circle.Radius();
}], {display: 'html', visible: false}); // Text displaying the circle radius
// Modify highlight and noHighlight method of circle.
circle.on('over', function(){
text.setAttribute({visible:true}); // show text element
});
circle.on('out', function(){
text.setAttribute({visible:false}); // hide text element
});