score:2

Accepted answer

you can render the text once, then look at the bounding box of the element to determine the width of the text, and then use this information to create a correctly positioned text by rendering it again.

for example:

var element = r.text('19% yoy increase ', 0 , 0)
.css({
    fontsize: '11px'
}).add();

var width = element.getbbox().width;
element.destroy();

r.text('19% yoy increase ', data[0].plotx + chart.plotleft - (width/2) , starty)
.css({
    color: '#4572a7',
    fontsize: '11px'           
}).add();

see this jsfiddle for a demonstration.


Related Query

More Query from same tag