jsxgraph label positioning
HTML
<link rel="stylesheet" href="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraph.css">
<script src="http://jsxgraph.uni-bayreuth.de/~michael/jsxgraph-nightly/jsxgraphcore.js"></script>
<div id='box' class='jxgbox'></div>
CSS
#box {
width:500px;
height:500px;
}
JavaScript
var brd = JXG.JSXGraph.initBoard('box', {axis: true, boundingbox: [-10,10,10,-10], grid: true, keepaspectratio: true});
var p1 = brd.create('point', [0,0], {name: 'end', face: 'diamond', size: 4, fixed: false, withLabel: true, label:{offsets: [-25,10]}});
var p2 = brd.create('point', [0, 4]);
// create a line over the y-axis
var line = brd.create('line', [p1, p2], {
name:"(D):y=3x+5",
withLabel: true,
label: {
// the y-axis is a corner case, play with the position values a little
position: 'lrt',
// fine tuning the position
offset: [-20, -30],
// this is important for rotating the text
display: 'internal'
}});
// access the label of the line
var txt = line.label.content;
var tRot = brd.create('transform', [Math.PI/2, 10, 20], {type:'rotate'});
tRot.bindTo(txt);
brd.update();