Wrappable Labels?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
phillip rhodes

Wrappable Labels?

Post by phillip rhodes » Wed Nov 13, 2002 7:18 am

Is there a way to wrap a label on the word break?

If you look at the graphs at
http://test.rhoderunner.com/hragraph/readme.html
I would like to break the words "minimal risk" moderate risk" etc into 2 lines so I can increase the font and improve readability.

Can anyone tell me how I can set the font for the categories (Cancer, Heart Disease, etc)?
Thanks.

Dave Gilbert

Re: Wrappable Labels?

Post by Dave Gilbert » Wed Nov 13, 2002 11:01 am

Hi Phillip,

I'm assuming you have used the HorizontalMarkerAxisBand class to display the "minimal risk", "moderate risk" etc. This doesn't have the facility to split the labels onto multiple lines, but you could probably modify the drawStringInRect(...) method to achieve that.

Setting the font for the vertical category axis is easy:

CategoryPlot plot = myChart.getCategoryPlot();
CategoryAxis domainAxis = plot.getDomainAxis();
domainAxis.setTickLabelFont(new Font(...));

Regards,

DG

Locked