1
votes

I am using anychart and need to wrap the text in the labels of the sunburst chart. Below is an extract of the current code:

chart.labels().fontSize(15);
chart.labels().wordWrap("break-word");
chart.labels().wordBreak("normal");

However this does not appear to be working (neither the font size, nor the word wrapping).

Any idea on how to make it work ?

2

2 Answers

1
votes

There's no need to enable useHtml() mode. You can adjust the fontSize via library API after disabling adjustFontSize. adjustFontSize is enabled as default and it tends to fit the label to the point. After disabling it you can manually apply required font-size. For details check the sample, pay attention to lines 24 - 26.

0
votes

To be able to style labels on Sunburst chart in Anychart you need to enable HTML for labels and use format method for inline styles:

chart.labels().useHtml(true);
chart.labels().format("<span style='font-size: 15px; word-break: normal; word-wrap: break-word;'>{%name}</span><br>{%value}");