Font of legend for pie chart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
leo
Posts: 8
Joined: Thu Jul 21, 2005 1:54 pm

Font of legend for pie chart

Post by leo » Wed Jul 27, 2005 10:34 am

Hi,

I am creating a pie chart and adding it to the pdf document. I create a pie chart from ChartFactory class and I try to change (reduce the font size) the Legend text font like :

LegendTitle legendTitle=piechart.getLegend();
legendTitle.setItemFont(new Font("TimesNewRoman", Font.PLAIN, 8));
plot.setLegendItemShape(Plot.DEFAULT_LEGEND_ITEM_BOX);

The pie chart object becomes null and does not print. I get a null pointer exception. Please let me know if you have any idea about this.

Thanks in Advance.

Deepak

dhchou
Posts: 138
Joined: Tue Jul 05, 2005 11:01 pm

Post by dhchou » Mon Aug 01, 2005 5:01 pm

I am assuming that the legend displayed just fine before you changed the fonts. I also assume that the smiley face is actually an integer followed by a closing parenthesis.

If both are true, then you might want to look at how Font family names are stored in your system. For example, on my system Times New Roman is stored as "Times New Roman", not "TimesNewRoman". You might also want to check whether the names are case sensitive.

Daniel

Locked