JasperReports, jFreeCharts and custom fonts

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
nKognito
Posts: 1
Joined: Wed Jun 04, 2014 8:39 am
antibot: No, of course not.

JasperReports, jFreeCharts and custom fonts

Post by nKognito » Wed Jun 04, 2014 8:45 am

I use DejaVu custom font in my reports.. Everything works fine until I added some charts.. Don't know why, but charts generated properly but labels are empty.. I implemented Customizer class which configures the font of labels:

Code: Select all

public class CustomFontCategoryChartCustomizer implements JRChartCustomizer  {
    @Override
    public void customize(JFreeChart chart, JRChart jasperChart) {
        Font customFont = new Font("DejaVu Serif", Font.PLAIN, 9);
        CategoryPlot plot = chart.getCategoryPlot();

        // Set legend's font        
        chart.getLegend().setItemFont(customFont);
        // Set categories label's font
        plot.getDomainAxis().setTickLabelFont(customFont);
        // Set amounts label's font 
        plot.getRangeAxis().setTickLabelFont(customFont);
    }
}
the code works fine at the developer machine, but at the production one there are no exception but all the labels at charts are empty!! The rest of report (details and header) works fine!

Any help? Thank you in advance

P.S.
Image

Locked