A discussion forum for JFreeChart (a 2D chart library for the Java platform).
-
matinh
- Posts: 483
- Joined: Fri Aug 11, 2006 10:08 am
- Location: Austria
Post
by matinh » Fri Aug 11, 2006 10:23 am
Hi!
I've got a problem with axis labels if they contain newline characters ('\n'). What I want to do is create a TimeSeriesChart and set the DateFormat (using the method setDateFormatOverride()) to something like "dd.MM.yyyy\nhh:mm".
The problem is that someone eats my linebreaks

They simply disappear.
I traced it down to org.jfree.text.TextUtilities.drawRotatedString(). This method still has the linebreak and passes the correct string on to Graphics2D.drawString(). This is where my trace ends as I've got no source code for this.
My question: is it possible to use linebreaks in axis labels at all? If yes, how?
many thanks in advance,
- martin
-
matinh
- Posts: 483
- Joined: Fri Aug 11, 2006 10:08 am
- Location: Austria
Post
by matinh » Wed Aug 16, 2006 2:16 pm
Am I the only one having this problem? Please let me know if you know how to solve this issue!
tia,
- martin
-
jwenting
- Posts: 157
- Joined: Sat Jul 15, 2006 7:46 am
Post
by jwenting » Wed Aug 16, 2006 2:20 pm
I've seen it as well during some experimenting. Doesn't bother me that much at the moment, though it would be nice to be able to define multiline labels (especially for long labels on the domain axis).
-
matinh
- Posts: 483
- Joined: Fri Aug 11, 2006 10:08 am
- Location: Austria
Post
by matinh » Wed Aug 16, 2006 2:41 pm
Thanks for your reply jwenting. At least I know now that I'm not alone with this problem

.
I'm afraid to fix this problem one has either to fix that bug/feature in Graphics2D.drawString() or investigate some work to do a split of the label and draw multiple text-boxes, one for each single line.
However, if someone could provide a workaround this would be really great so far.
Any comments?
- martin
-
oacis
- Posts: 101
- Joined: Fri Jan 07, 2005 5:57 am
- Location: Australia, Sydney
Post
by oacis » Thu Aug 17, 2006 12:14 am
There are a few feature requests for line breaks on the sourceforge tracker. I have supplied a patch for multi-line Axis titles and will hopefully have a patch for the tick labels soon.
In the Axis class, the new line characters are not taken into account in the FontMetrics class which means that the space is not reserved for drawing of the labels. And as you pointed out the Graphics2D doesn't draw new line characters at all.
-
matinh
- Posts: 483
- Joined: Fri Aug 11, 2006 10:08 am
- Location: Austria
Post
by matinh » Thu Aug 17, 2006 8:38 am
oacis wrote:There are a few feature requests for line breaks on the sourceforge tracker. I have supplied a patch for multi-line Axis titles and will hopefully have a patch for the tick labels soon.
Could you please point me to the patch. I found a few posts regarding multiline axis labels but none had a patch attached.
And where will you publish your patch for the tick labels once you got it? On the sourceforge page as well?
many thanks,
- martin
-
oacis
- Posts: 101
- Joined: Fri Jan 07, 2005 5:57 am
- Location: Australia, Sydney
Post
by oacis » Sat Aug 19, 2006 1:21 am
THere is a minor problem with rotated text which I will look into today and do some more testing. It depends on me getting the problems fixed and the release schedule of JFreeChart.
-
gregpass
- Posts: 3
- Joined: Tue Apr 18, 2006 5:47 pm
Post
by gregpass » Tue Oct 31, 2006 4:53 pm
matinh wrote:oacis wrote:There are a few feature requests for line breaks on the sourceforge tracker. I have supplied a patch for multi-line Axis titles and will hopefully have a patch for the tick labels soon.
Could you please point me to the patch. I found a few posts regarding multiline axis labels but none had a patch attached.
I've looked on sourceforge but cannot find this patch in the "patches" area? The only patch by "oacis" is unrelated.
Thanks.
-
matinh
- Posts: 483
- Joined: Fri Aug 11, 2006 10:08 am
- Location: Austria
Post
by matinh » Wed Nov 01, 2006 12:02 pm
oacis sent me a private message a week ago or so, that he was on vacation and will finish the work when he is back.
- martin
-
LukasW
- Posts: 9
- Joined: Thu Nov 02, 2006 8:10 pm
Post
by LukasW » Wed Nov 29, 2006 1:33 pm
I also really need to have multline axis label, has anyone figured out a solution to this/found the patch?
thanx
//Lukas