Reputation: 33
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 ?
Upvotes: 3
Views: 1027
Reputation: 3905
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.
Upvotes: 1
Reputation: 1099
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}");
Upvotes: 2