Centering label in Highcharts General Drawing
Can this be achieved by using the Renderer framework, by adding a line of code in .attr ? I've created a flowchart, similar to the one found here: https://www.highcharts.com/demo/renderer. The label text is left-aligned by default but I wish for it to be center-aligned by default, using the Renderer framework, e.g.,
ren.label('Test is a label', 660, 680)
.attr({
fill: 'black',
stroke: 'black',
'stroke-width': 2,
padding: 5,
r: 0
})
.css({
color: 'white',
width: '100px'
})
.add()
.shadow(true);
The align: center attribute does the job: http://jsfiddle.net/3ma5f1Lq/2/
-
Anonymous commented
Addendum: the align: statement moves the black text box itself but does not change the alignment of the text contained within the text box. I've changed the statement to align: right and align: left also and it is the black text box itself that moves, but the text contained within the text box itself stays aligned to the left.
-
Anonymous commented
Hello, Thank you for your reply. I went to the jsfiddle link and made the label longer. Although the label text wrapped (which is good), the label text remains left-aligned, even with align: center. It looks like this on screen (Other suggestions to try?):
------------------------
|Test is a label |
|for many people |
|to admire on the |
|screen |
-----------------------