Hi,
We have used JFreeChart for some time. We found that it display the category string with too much space.
We want to change to a thinner font like Arial Narrow. Can any one suggest the sample code to change font. Does java.awt.Font support other fonts?
Thanks.
Kenny
how to change thinner font in chart
Re: how to change thinner font in chart
Hi Kenny,
You can use java.awt.Font for any font you have installed on your system. I usually try to stick to the Java logical fonts, since they are guaranteed to be on all systems, but there's nothing to stop you accessing other fonts by name:
CategoryPlot plot = myChart.getCategoryPlot();
CategoryAxis axis = plot.getDomainAxis();
Font font = new Font("Arial Narrow", Font.PLAIN, 10);
axis.setTickLabelFont(font);
Regards,
DG
You can use java.awt.Font for any font you have installed on your system. I usually try to stick to the Java logical fonts, since they are guaranteed to be on all systems, but there's nothing to stop you accessing other fonts by name:
CategoryPlot plot = myChart.getCategoryPlot();
CategoryAxis axis = plot.getDomainAxis();
Font font = new Font("Arial Narrow", Font.PLAIN, 10);
axis.setTickLabelFont(font);
Regards,
DG