I've got legacy code sample which uses JFreeChart and XYPlot. Now i'm making i18n for that code and most of non-english strings are much longer then english ones. I googled for a way to wrap strings. No success. Help please!
Asked
Active
Viewed 2,923 times
3
-
maybe i chose wrong word...I don't want to rotate labels. I want labels to be drawed in two or three lines each. Labels are too long to be drawed in one line. – Aleksandr Kravets Apr 05 '12 at 12:12
-
I should have said: Because multiple lines are [not supported](http://jfree.org/phpBB2/viewtopic.php?f=3&t=4558), you might try `setVerticalTickLabels()`, shown [here](http://stackoverflow.com/a/5522583/230513). – trashgod Apr 05 '12 at 12:42
-
Sorry, but i'm talking about labels along vertical axis. I should have been more specific. As i see it, only multiple lines will solve my problem. If they are not supported, i'll search for another ways, like ask interpreteurs to shorten translated texts. – Aleksandr Kravets Apr 05 '12 at 14:21
2 Answers
11
Try using setMaximumCategoryLabelLines
method from CategoryAxis
, e.g:
CategoryAxis domainAxis = plot.getDomainAxis();
domainAxis.setMaximumCategoryLabelLines(3);

Jakub Godoniuk
- 404
- 1
- 7
- 11
2
Multiple lines are not supported. The setVerticalTickLabels()
method may be applied to either a domain or a range axis. Because space is limited, interpreters should be frugal. Providing a user setting, as shown here, may mitigate the limitation.