I have a few charts that end up with long titles, and the titles end up getting clipped off the right side of the chart. I'd like to be able to improve this situation if possible. I've looked at prior posts on the subject, but haven't found one that gives me a good idea on the best way to approach this.
I've looked at the TextTitle class, and considered a few fixes to solve my problem, but i'm wondering if there is a definite "good" approach to take here. For example, am I better of shrinking the text to fit? Or should I consider wrapping the text? If so, how does the chart know that the title is bigger (height) than what was expected? Should I enlarge the chart size?
As you can see, there are a lot of possibilities here. But until I start coding one of them, I won't really know the difficulties I will face since I don't know the graphing code that well at this point.
Therefore, does anyone have a suggestion on how they may have approached this and what the best ways to tackle the problem are?
Thanks,
Michael
Long Titles On Charts
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
I think a good approach is to wrap the text. The layout method used by JFreeChart assigns each title its preferred space and the plot gets to use whatever is left. You'll need to modify the getPreferredHeight() method to return the height required for the wrapped text.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader

