3

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!

Aleksandr Kravets
  • 5,750
  • 7
  • 53
  • 72
  • 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 Answers2

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.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045